[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Use --root arg for installation test
commit 2ec94c9b14c991440e3c0edeeb638b09802b54a5
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Tue Apr 7 15:04:33 2020 -0700
Use --root arg for installation test
Third time's the charm? Jenkins has a 'dist-packages' site path, causing our
hack to continue to mismatch...
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/tmp/stem_test/lib/python3.7/site-packages/
and your PYTHONPATH environment variable currently contains:
'/tmp/stem_test/lib/python3.7/dist-packages'
This test failure doesn't reproduce for me, but experimentation indicates that
the '--root' argument acts similarly to '--prefix' but does not produce this
warning.
The installation path differs slightly, so accounting for this in the
test...
% python setup.py install --prefix /tmp/my_path
installs to /tmp/my_path/lib/python3.7/site-packages/stem-1.8.0.dev0-py3.7.egg/stem/
% python setup.py install --root /tmp/my_path
installs to /tmp/my_path/usr/local/lib/python3.7/site-packages/stem/
---
test/integ/installation.py | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/test/integ/installation.py b/test/integ/installation.py
index fbf7267e..657b5d88 100644
--- a/test/integ/installation.py
+++ b/test/integ/installation.py
@@ -6,7 +6,6 @@ import glob
import os
import platform
import shutil
-import site
import sys
import tarfile
import time
@@ -45,7 +44,7 @@ def _assert_has_all_files(path):
for root, dirnames, filenames in os.walk(path):
for filename in filenames:
- if not filename.endswith('.pyc') and 'EGG-INFO' not in root:
+ if not filename.endswith('.pyc') and 'egg-info' not in root:
installed.add(os.path.join(root, filename)[len(path) + 1:])
missing = expected.difference(installed)
@@ -71,32 +70,15 @@ class TestInstallation(unittest.TestCase):
install.
"""
- # Some systems fail installation unless our PYTHONPATH cites the
- # site-packages that will be created at this destination. Unfortunately
- # this can vary so attempting to determine it from site.getsitepackages().
- # For example...
- #
- # /tmp/stem_test/lib/python3.7/site-packages/
-
- site_packages = site.getsitepackages()
-
- if site_packages and site_packages[0].count(os.path.sep) >= 3:
- python_path = os.path.sep.join([BASE_INSTALL_PATH] + site_packages[0].split(os.path.sep)[-3:])
-
- if not os.path.exists(python_path):
- os.makedirs(python_path)
- else:
- python_path = ''
-
try:
try:
- stem.util.system.call('%s setup.py install --prefix %s' % (PYTHON_EXE, BASE_INSTALL_PATH), timeout = 60, cwd = test.STEM_BASE, env = {'PYTHONPATH': python_path})
+ stem.util.system.call('%s setup.py install --root %s' % (PYTHON_EXE, BASE_INSTALL_PATH), timeout = 60, cwd = test.STEM_BASE)
stem.util.system.call('%s setup.py clean --all' % PYTHON_EXE, timeout = 60, cwd = test.STEM_BASE) # tidy up the build directory
if platform.python_implementation() == 'PyPy':
- site_packages_paths = glob.glob('%s/site-packages' % BASE_INSTALL_PATH)
+ site_packages_paths = glob.glob('%s/*/*/site-packages' % BASE_INSTALL_PATH)
else:
- site_packages_paths = glob.glob('%s/lib*/*/site-packages/stem-*' % BASE_INSTALL_PATH)
+ site_packages_paths = glob.glob('%s/*/*/lib*/*/site-packages' % BASE_INSTALL_PATH)
except stem.util.system.CallError as exc:
msg = ["Unable to install with '%s': %s" % (exc.command, exc.msg)]
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits