aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Teivonen <patrik.teivonen@qt.io>2022-04-07 09:47:35 +0300
committerPatrik Teivonen <patrik.teivonen@qt.io>2022-04-11 12:05:00 +0000
commite1b2713a41768ab2ae921a1f6f872ed8230a01e5 (patch)
treea362f2a64f315ca78a64c65f51e88c08a34b0a6b
parentf362c96d105e2c541015dcd2b610776b611f1928 (diff)
bld_utils.py:getEnvironment(): change method to get system environ dict
Platforms supporting bytes environment returned the raw dictionary data in bytes. Instead wrap os.environ with dict() so that the environment dictionary is consistent on all platforms making it easier to work with Change-Id: Ic3461bc2ed4deaf83364d6ae49f643915d4c77bb Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--packaging-tools/bld_utils.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/packaging-tools/bld_utils.py b/packaging-tools/bld_utils.py
index 3906de9b5..b585a436f 100644
--- a/packaging-tools/bld_utils.py
+++ b/packaging-tools/bld_utils.py
@@ -192,10 +192,6 @@ def download(url, target, read_block_size = 1048576):
pass
def setValueOnEnvironmentDict(environment, key, value):
- # convert PATH to Path to avoid duplicates
- if os.name == 'nt' and key == 'PATH':
- key = 'Path'
-
if key in environment:
# if the data already contains the value stop here
if value in environment[key].split(os.pathsep):
@@ -209,7 +205,7 @@ def getEnvironment(init_environment = None, callerArguments = None):
if init_environment is None:
init_environment = {}
# first take the one from the system and use the plain dictionary data for that
- environment = os.environ.__dict__["_data"]
+ environment = dict(os.environ)
if hasattr(callerArguments, 'environment_batch') and callerArguments.environment_batch:
environment = environmentfrombatchfile.get(
@@ -280,7 +276,7 @@ def runCommand(command, currentWorkingDirectory, callerArguments = None, init_en
os.path.isfile(os.path.abspath(os.path.join(currentWorkingDirectory, commandAsList[0]))):
commandAsList[0] = os.path.abspath(os.path.join(currentWorkingDirectory, commandAsList[0]))
- pathEnvironment = environment[b'PATH'] if os.supports_bytes_environ else environment['PATH']
+ pathEnvironment = environment['PATH']
# if we can not find the command, check the environment
if not os.path.lexists(commandAsList[0]) and find_executable(str(commandAsList[0]), str(pathEnvironment)):
commandAsList[0] = find_executable(str(commandAsList[0]), str(pathEnvironment))