summaryrefslogtreecommitdiff
path: root/scripts/link_pyqt.py
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2015-03-26 13:16:48 +0100
committerFlorian Bruhin <git@the-compiler.org>2015-03-26 13:16:48 +0100
commitfc14b5b6b2595ce59bbecde36da03332874b7c1f (patch)
tree3af9689cad9e1a927803e2d6d511f2c889a2f9d8 /scripts/link_pyqt.py
parent82852456417f5a3049e22f1c01364f0524c3bf30 (diff)
downloadqutebrowser-fc14b5b6b2595ce59bbecde36da03332874b7c1f.tar.gz
qutebrowser-fc14b5b6b2595ce59bbecde36da03332874b7c1f.zip
Fix link_pyqt.py on Debian/Windows.
Diffstat (limited to 'scripts/link_pyqt.py')
-rw-r--r--scripts/link_pyqt.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/link_pyqt.py b/scripts/link_pyqt.py
index 4e0c725fd..3d584127b 100644
--- a/scripts/link_pyqt.py
+++ b/scripts/link_pyqt.py
@@ -27,6 +27,7 @@ import os.path
import sys
import glob
import subprocess
+import platform
class Error(Exception):
@@ -95,9 +96,23 @@ def link_pyqt(sys_path, venv_path):
def get_python_lib(executable):
"""Get the python site-packages directory for the given executable."""
- return subprocess.check_output(
- [executable, '-c', 'from distutils.sysconfig import get_python_lib\n'
- 'print(get_python_lib())'], universal_newlines=True).rstrip()
+ distribution = platform.linux_distribution(full_distribution_name=False)
+ if os.name == 'nt':
+ # For some reason, we get an empty string from get_python_lib() on
+ # Windows when running via tox, and sys.prefix is empty too...
+ return os.path.join(os.path.dirname(executable), '..', 'Lib',
+ 'site-packages')
+ elif distribution[0].lower() in ('debian', 'ubuntu'):
+ # For some reason, we get '/usr/lib/python3.4/site-packages' instead of
+ # '/usr/lib/python3/dist-packages' on debian with tox...
+ cmd = [executable, '-c', 'import sys\nprint(sys.prefix)']
+ prefix = subprocess.check_output(cmd, universal_newlines=True).rstrip()
+ return os.path.join(prefix, 'lib', 'python3', 'dist-packages')
+ else:
+ cmd = [executable, '-c',
+ 'from distutils.sysconfig import get_python_lib\n'
+ 'print(get_python_lib())']
+ return subprocess.check_output(cmd, universal_newlines=True).rstrip()
def get_tox_syspython(venv_path):