Don't use {envsitepackagesdir} for link_pyqt.py.
It seems this is broken (and passes the global path) on Ubuntu Trusty.
This commit is contained in:
parent
738f6a4510
commit
cb3fcd3d8a
@ -94,15 +94,20 @@ def link_pyqt(sys_path, venv_path):
|
|||||||
os.symlink(source, dest)
|
os.symlink(source, dest)
|
||||||
|
|
||||||
|
|
||||||
def get_python_lib(executable):
|
def get_python_lib(executable, venv=False):
|
||||||
"""Get the python site-packages directory for the given executable."""
|
"""Get the python site-packages directory for the given executable.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
venv: True if the path is inside a virtualenv, so our special
|
||||||
|
treatments for Windows/Ubuntu shouldn't take place.
|
||||||
|
"""
|
||||||
distribution = platform.linux_distribution(full_distribution_name=False)
|
distribution = platform.linux_distribution(full_distribution_name=False)
|
||||||
if os.name == 'nt':
|
if os.name == 'nt' and not venv:
|
||||||
# For some reason, we get an empty string from get_python_lib() on
|
# For some reason, we get an empty string from get_python_lib() on
|
||||||
# Windows when running via tox, and sys.prefix is empty too...
|
# Windows when running via tox, and sys.prefix is empty too...
|
||||||
return os.path.join(os.path.dirname(executable), '..', 'Lib',
|
return os.path.join(os.path.dirname(executable), '..', 'Lib',
|
||||||
'site-packages')
|
'site-packages')
|
||||||
elif distribution[0].lower() in ('debian', 'ubuntu'):
|
elif distribution[0].lower() in ('debian', 'ubuntu') and not venv:
|
||||||
# For some reason, we get '/usr/lib/python3.4/site-packages' instead of
|
# For some reason, we get '/usr/lib/python3.4/site-packages' instead of
|
||||||
# '/usr/lib/python3/dist-packages' on debian with tox...
|
# '/usr/lib/python3/dist-packages' on debian with tox...
|
||||||
cmd = [executable, '-c', 'import sys\nprint(sys.prefix)']
|
cmd = [executable, '-c', 'import sys\nprint(sys.prefix)']
|
||||||
@ -128,8 +133,6 @@ def main():
|
|||||||
"""Main entry point."""
|
"""Main entry point."""
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('path', help="Base path to the venv.")
|
parser.add_argument('path', help="Base path to the venv.")
|
||||||
parser.add_argument('site_path', help="Path to the venv site-packages "
|
|
||||||
"folder (for tox).", nargs='?')
|
|
||||||
parser.add_argument('--tox', help="Add when called via tox.",
|
parser.add_argument('--tox', help="Add when called via tox.",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -139,12 +142,9 @@ def main():
|
|||||||
else:
|
else:
|
||||||
sys_path = get_python_lib(sys.executable)
|
sys_path = get_python_lib(sys.executable)
|
||||||
|
|
||||||
if args.site_path is None:
|
|
||||||
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
||||||
executable = os.path.join(args.path, subdir, 'python')
|
executable = os.path.join(args.path, subdir, 'python')
|
||||||
venv_path = get_python_lib(executable)
|
venv_path = get_python_lib(executable, venv=True)
|
||||||
else:
|
|
||||||
venv_path = args.site_path
|
|
||||||
|
|
||||||
link_pyqt(sys_path, venv_path)
|
link_pyqt(sys_path, venv_path)
|
||||||
|
|
||||||
|
2
tox.ini
2
tox.ini
@ -10,7 +10,7 @@ envlist = unittests,misc,pep257,flake8,pylint,pyroma,check-manifest
|
|||||||
basepython = python3
|
basepython = python3
|
||||||
|
|
||||||
[testenv:mkvenv]
|
[testenv:mkvenv]
|
||||||
commands = {envpython} scripts/link_pyqt.py --tox {envdir} {envsitepackagesdir}
|
commands = {envpython} scripts/link_pyqt.py --tox {envdir}
|
||||||
envdir = {toxinidir}/.venv
|
envdir = {toxinidir}/.venv
|
||||||
usedevelop = true
|
usedevelop = true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user