eric6/Plugins/VcsPlugins/vcsGit/GitUtilities.py

branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 6942
2602857055c5
child 7229
53054eb5b15a
equal deleted inserted replaced
7191:960850ec284c 7192:a22eee00b052
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os 12 import os
13 import sys
14 13
15 from PyQt5.QtCore import QProcessEnvironment, QByteArray 14 from PyQt5.QtCore import QProcessEnvironment
16 15
17 import Utilities 16 import Utilities
18 17
19 18
20 def getConfigPath(): 19 def getConfigPath():
43 # set the language for the process 42 # set the language for the process
44 if language: 43 if language:
45 env.insert("LANGUAGE", language) 44 env.insert("LANGUAGE", language)
46 45
47 proc.setProcessEnvironment(env) 46 proc.setProcessEnvironment(env)
48
49
50 try:
51 from Globals import strToQByteArray
52 except ImportError:
53 def strToQByteArray(txt):
54 """
55 Module function to convert a Python string into a QByteArray.
56
57 @param txt Python string to be converted
58 @type str, bytes, bytearray, unicode
59 """
60 if sys.version_info[0] == 2:
61 if isinstance(txt, unicode): # __IGNORE_WARNING__
62 txt = txt.encode("utf-8")
63 else:
64 if isinstance(txt, str):
65 txt = txt.encode("utf-8")
66
67 return QByteArray(txt)

eric ide

mercurial