aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Thiem <ptthiem@gmail.com>2013-11-11 18:27:52 -0600
committerPhilip Thiem <ptthiem@gmail.com>2013-11-11 18:27:52 -0600
commit2988952f831be3769896f729f0d7f1ae07f6bdee (patch)
tree2c743a7fbd49e175513a1aae7d20d7fead99b42e
parent76423012b5b51691dd059b1276351099e52c787e (diff)
downloadexternal_python_setuptools-2988952f831be3769896f729f0d7f1ae07f6bdee.tar.gz
external_python_setuptools-2988952f831be3769896f729f0d7f1ae07f6bdee.tar.bz2
external_python_setuptools-2988952f831be3769896f729f0d7f1ae07f6bdee.zip
Earlier Versions of python used gzip and tar directly. So I need to
make sure they are in the paths for the legacy tests (why did it work before). Let us hope that svn is not in that directory...
-rw-r--r--setuptools/tests/environment.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/setuptools/tests/environment.py b/setuptools/tests/environment.py
index b41e1549..bd2c53d2 100644
--- a/setuptools/tests/environment.py
+++ b/setuptools/tests/environment.py
@@ -107,6 +107,15 @@ class ZippedEnvironment(unittest.TestCase):
pass
+def _which_dirs(cmd):
+ result = set()
+ for path in os.environ.get('PATH', '').split(os.pathsep):
+ filename = os.path.join(path, cmd)
+ if os.access(filename, os.X_OK):
+ result.add(path)
+ return result
+
+
def run_setup_py(cmd, pypath=None, path=None,
data_stream=0, env=None):
"""
@@ -115,22 +124,19 @@ def run_setup_py(cmd, pypath=None, path=None,
"""
if env is None:
env = dict()
+ for envname in os.environ:
+ env[envname] = os.environ[envname]
#override the python path if needed
- if pypath is None:
- env["PYTHONPATH"] = os.environ.get("PYTHONPATH", "")
- else:
+ if pypath is not None:
env["PYTHONPATH"] = pypath
- #oeride the execution path if needed
- if path is None:
- env["PATH"] = os.environ.get("PATH", "")
- else:
- env["PATH"] = pypath
-
- #Apparently this might be needed in windows platforms
- if "SYSTEMROOT" in os.environ:
- env["SYSTEMROOT"] = os.environ["SYSTEMROOT"]
+ #overide the execution path if needed
+ if path is not None:
+ env["PATH"] = path
+ if not env.get("PATH", ""):
+ env["PATH"] = _which_dirs("tar").union(_which_dirs("gzip"))
+ env["PATH"] = os.pathsep.join(env["PATH"])
cmd = [sys.executable, "setup.py"] + list(cmd)