diff options
author | toofar <toofar@spalge.com> | 2023-05-07 13:49:19 +1200 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2023-05-07 13:49:19 +1200 |
commit | 8168fb983e013bf28edbe16410625e0e9b30892f (patch) | |
tree | 88d8a02cd7ceddab549ea337fb0ee3f770e4c154 /scripts | |
parent | 8b2b4fc61e16cc6e8d8ad966dd1a6eeabd72652b (diff) | |
download | qutebrowser-8168fb983e013bf28edbe16410625e0e9b30892f.tar.gz qutebrowser-8168fb983e013bf28edbe16410625e0e9b30892f.zip |
update link_pyqt for tox 4
Although we updated the tox requirements files for tox4 in December, it
looks like the docker containers (or at least the one(s) that call this
script) are still using tox3. `.tox-config1` isn't written anymore with
tox4 (although my git-fu isn't strong enough to find the commit that
removed it).
The "Rebuild Docker CI images" run 912 was the last to have tox 3.26.0-2
and run 913 had version 4.4.12-1.
I'm not sure the new change does the same thing as whatever the old code
did. I honestly have no idea why we can't just follow the python symlink
and have to go to a config file. In what case does the python binary not
link to the system one?
In addition to this `.tox-info.json` file there is also the more
standard `pyvenv.cfg` file. I would prefer to use that over the tox
thing as generally I find tox to be a high barrier of entry for
contributors. But in that case the pyvenv one doesn't seem to be well
documented either...
Anyway, if anyone knows any cases where following the symlink of the
python in the venv isn't reliable that would be great. Because that
seems like the simpler method.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/link_pyqt.py | 13 |
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) |