summaryrefslogtreecommitdiff
path: root/scripts/link_pyqt.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/link_pyqt.py')
-rw-r--r--scripts/link_pyqt.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/link_pyqt.py b/scripts/link_pyqt.py
index ff524f056..028c18ee2 100644
--- a/scripts/link_pyqt.py
+++ b/scripts/link_pyqt.py
@@ -28,6 +28,7 @@ import sys
import subprocess
import tempfile
import filecmp
+import json
class Error(Exception):
@@ -200,9 +201,15 @@ def get_venv_lib_path(path):
def get_tox_syspython(tox_path):
"""Get the system python based on a virtualenv created by tox."""
path = os.path.join(tox_path, '.tox-config1')
- with open(path, encoding='ascii') as f:
- line = f.readline()
- _md5, sys_python = line.rstrip().split(' ', 1)
+ if os.path.exists(path): # tox3
+ with open(path, encoding='ascii') as f:
+ line = f.readline()
+ _md5, sys_python = line.rstrip().split(' ', 1)
+ else: # tox4
+ path = os.path.join(tox_path, '.tox-info.json')
+ with open(path, encoding='utf-8') as f:
+ data = json.load(f)
+ sys_python = data["Python"]["executable"]
# Follow symlinks to get the system-wide interpreter if we have a tox isolated
# build.
return os.path.realpath(sys_python)