[PATCH] D50388: Respect PYTHONPATH
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 21:36:00 PDT 2018
greened updated this revision to Diff 162132.
greened added a comment.
Moved comment as directed.
https://reviews.llvm.org/D50388
Files:
utils/lit/tests/Inputs/shtest-timeout/lit.cfg
utils/lit/tests/lit.cfg
Index: utils/lit/tests/lit.cfg
===================================================================
--- utils/lit/tests/lit.cfg
+++ utils/lit/tests/lit.cfg
@@ -34,7 +34,13 @@
else:
lit_path = src_root
-config.environment['PYTHONPATH'] = lit_path # Required because some tests import the lit module
+pythonpath_list = [lit_path] # Required because some tests import the lit module
+if 'PYTHONPATH' in os.environ:
+ pythonpath_list.append(os.environ['PYTHONPATH'])
+if 'PYTHONPATH' in config.environment:
+ pythonpath_list.append(config.environment['PYTHONPATH'])
+config.environment['PYTHONPATH'] = os.pathsep.join(pythonpath_list)
+
config.substitutions.append(('%{src_root}', src_root))
config.substitutions.append(('%{inputs}', os.path.join(
src_root, 'tests', 'Inputs')))
Index: utils/lit/tests/Inputs/shtest-timeout/lit.cfg
===================================================================
--- utils/lit/tests/Inputs/shtest-timeout/lit.cfg
+++ utils/lit/tests/Inputs/shtest-timeout/lit.cfg
@@ -28,5 +28,12 @@
config.test_exec_root = config.test_source_root
config.target_triple = '(unused)'
src_root = os.path.join(config.test_source_root, '..')
-config.environment['PYTHONPATH'] = src_root
+
+pythonpath_list = [src_root]
+if 'PYTHONPATH' in os.environ:
+ pythonpath_list.append(os.environ['PYTHONPATH'])
+if 'PYTHONPATH' in config.environment:
+ pythonpath_list.append(config.environment['PYTHONPATH'])
+config.environment['PYTHONPATH'] = os.pathsep.join(pythonpath_list)
+
config.substitutions.append(('%{python}', sys.executable))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50388.162132.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180823/7c81cdc0/attachment.bin>
More information about the llvm-commits
mailing list