You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2019/03/22 14:43:05 UTC
[qpid-dispatch] branch master updated: NO-JIRA: prevent python
system paths from leaking into the test environment This closes #474
This is an automated email from the ASF dual-hosted git repository.
tross pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 11c6a43 NO-JIRA: prevent python system paths from leaking into the test environment This closes #474
11c6a43 is described below
commit 11c6a4350a00bf36b6fd8efb31b0223eeb79cdc0
Author: Kenneth Giusti <kg...@apache.org>
AuthorDate: Wed Mar 20 21:45:00 2019 -0400
NO-JIRA: prevent python system paths from leaking into the test environment
This closes #474
---
run.py.in | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/run.py.in b/run.py.in
index 56edc61..5ffd388 100755
--- a/run.py.in
+++ b/run.py.in
@@ -42,28 +42,32 @@ run.py --sh # Print a shell script to set the run
import os, sys, runpy
from subprocess import Popen, PIPE
+extra_paths = [
+ "${CMAKE_SOURCE_DIR}/python",
+ "${CMAKE_BINARY_DIR}/python",
+ "${CMAKE_SOURCE_DIR}/tests"
+]
+
def dedup(l):
"""Remove duplicates from list l, keep first instance. Keep order of l."""
s = set()
return [i for i in l if i not in s and (s.add(i) or True)]
-sys.path = dedup([
- "${CMAKE_SOURCE_DIR}/python",
- "${CMAKE_BINARY_DIR}/python",
- "${CMAKE_SOURCE_DIR}/tests"
-] + sys.path)
-
def getpath(env):
+ """Return a path environment variable split into a list"""
path = os.environ.get(env)
if path:
return path.split(os.pathsep)
return []
+sys.path = dedup(extra_paths + sys.path)
+python_path = dedup(extra_paths + getpath("PYTHONPATH"))
+
# runner program (e.g. valgrind) and args used to run qdrouterd
qdrouterd_runner = "${QDROUTERD_RUNNER}"
env_vars = {
- 'PYTHONPATH': os.pathsep.join(sys.path),
+ 'PYTHONPATH': os.pathsep.join(python_path),
'PATH': os.pathsep.join(dedup(["${CMAKE_BINARY_DIR}",
os.path.join("${CMAKE_BINARY_DIR}", 'tests'),
os.path.join("${CMAKE_BINARY_DIR}", 'router'),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org