Commit 7326bdfa authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #1709 from radiasoft/master

uniquify paths in PYTHONPATH
parents 7a80e29b 1b4ef963
In test.paths_on_python_path, avoid adding unnecessary duplicates to the PYTHONPATH.
...@@ -15,6 +15,7 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path, ...@@ -15,6 +15,7 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path,
working_set, _namespace_packages, evaluate_marker, working_set, _namespace_packages, evaluate_marker,
add_activation_listener, require, EntryPoint) add_activation_listener, require, EntryPoint)
from setuptools import Command from setuptools import Command
from .build_py import _unique_everseen
__metaclass__ = type __metaclass__ = type
...@@ -186,7 +187,7 @@ class test(Command): ...@@ -186,7 +187,7 @@ class test(Command):
orig_pythonpath = os.environ.get('PYTHONPATH', nothing) orig_pythonpath = os.environ.get('PYTHONPATH', nothing)
current_pythonpath = os.environ.get('PYTHONPATH', '') current_pythonpath = os.environ.get('PYTHONPATH', '')
try: try:
prefix = os.pathsep.join(paths) prefix = os.pathsep.join(_unique_everseen(paths))
to_join = filter(None, [prefix, current_pythonpath]) to_join = filter(None, [prefix, current_pythonpath])
new_path = os.pathsep.join(to_join) new_path = os.pathsep.join(to_join)
if new_path: if new_path:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment