src/eric7/Plugins/VcsPlugins/vcsGit/GitUtilities.py

Tue, 12 Dec 2023 09:35:39 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 12 Dec 2023 09:35:39 +0100
branch
eric7
changeset 10403
ea3320d5e8e9
parent 9653
e67609152c5e
child 10438
4cd7e5a8b3cf
permissions
-rw-r--r--

Changed code using "shutil.rmtree()" more readable by adding "ignore_errors=" where this parameter is non-default.

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

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

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

import os

from PyQt6.QtCore import QProcessEnvironment

from eric7.SystemUtilities import OSUtilities


def getConfigPath():
    """
    Public function to get the filename of the config file.

    @return filename of the config file (string)
    """
    if OSUtilities.isWindowsPlatform():
        userprofile = os.environ["USERPROFILE"]
        return os.path.join(userprofile, ".gitconfig")
    else:
        homedir = OSUtilities.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