eric6/Plugins/VcsPlugins/vcsGit/GitUtilities.py

Sat, 19 Dec 2020 15:22:26 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 19 Dec 2020 15:22:26 +0100
changeset 7900
72b88fb20261
parent 7780
41420f82c0ac
child 7923
91e843545d9a
permissions
-rw-r--r--

Corrected the use of '@keyparam' in the source documentation.

# -*- coding: utf-8 -*-

# Copyright (c) 2014 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing some common utility functions for the Git package.
"""

import os

from PyQt5.QtCore import QProcessEnvironment

import Utilities


def getConfigPath():
    """
    Public function to get the filename of the config file.
    
    @return filename of the config file (string)
    """
    if Utilities.isWindowsPlatform():
        userprofile = os.environ["USERPROFILE"]
        return os.path.join(userprofile, ".gitconfig")
    else:
        homedir = Utilities.getHomeDir()
        return os.path.join(homedir, ".gitconfig")


def prepareProcess(proc, language=""):
    """
    Public function to prepare the given process.
    
    @param proc reference to the process to be prepared (QProcess)
    @param language language to be set (string)
    """
    env = QProcessEnvironment.systemEnvironment()
    
    # set the language for the process
    if language:
        env.insert("LANGUAGE", language)
    
    proc.setProcessEnvironment(env)

eric ide

mercurial