[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [craft] bin: Raise an exception if we can't parse the environment
From: Hannah von Reth <null () kde ! org>
Date: 2018-09-27 9:08:09
Message-ID: E1g5SHJ-0004i0-77 () code ! kde ! org
[Download RAW message or body]
Git commit eacbe3f6a1df1939367596d36b9ee8eec893f370 by Hannah von Reth.
Committed on 27/09/2018 at 09:08.
Pushed by vonreth into branch 'master'.
Raise an exception if we can't parse the environment
M +7 -4 bin/CraftSetupHelper.py
https://commits.kde.org/craft/eacbe3f6a1df1939367596d36b9ee8eec893f370
diff --git a/bin/CraftSetupHelper.py b/bin/CraftSetupHelper.py
index 0f39ef32a..ae91fa42c 100644
--- a/bin/CraftSetupHelper.py
+++ b/bin/CraftSetupHelper.py
@@ -183,10 +183,13 @@ class SetupHelper(object):
@staticmethod
def stringToEnv(string : str):
for line in string.split("\n"):
- key, value = line.strip().split("=", 1)
- if key == 'Path':
- key = 'PATH'
- os.environ[key] = value
+ kv = line.strip().split("=", 1)
+ if len(kv) != 2:
+ raise Exception(f"Failed to parse environment variable: {line}")
+ # TODO: why?
+ if kv[0] == "Path":
+ kv[0] = "PATH"
+ os.environ[kv[0]] = kv[1]
return os.environ
@staticmethod
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic