[gtk-osx] Conditionally set $PYTHON and libxml2's python-install-dir.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx] Conditionally set $PYTHON and libxml2's python-install-dir.
- Date: Mon, 17 Aug 2020 19:46:53 +0000 (UTC)
commit 9008438da32bd2c3d6092ffe92e52dc336c39c53
Author: John Ralls <jralls ceridwen us>
Date: Mon Aug 17 12:37:55 2020 -0700
Conditionally set $PYTHON and libxml2's python-install-dir.
Depending on python3 or meta-gtk-osx-python3 being in the
modules argument. As noted in the comment this is far from ideal.
jhbuildrc-gtk-osx | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/jhbuildrc-gtk-osx b/jhbuildrc-gtk-osx
index 7892e64..4a6048e 100644
--- a/jhbuildrc-gtk-osx
+++ b/jhbuildrc-gtk-osx
@@ -590,21 +590,26 @@ if not _ran_recursively and _gtk_osx_prompt_prefix:
# we're not building python because if it tries to install in the
# virtenv site-packages jhbuild will refuse to install it. Ideally
# we'd do this only if not building python because if we do then it
-# finds the right place and does the right thing. Unfortunately
-# there's no way to get the config object from the project to find out
-# if we're building python.
-
-# Note that this will break if the built python is a different major + minor
-# version from the virtenv one.
-_python_ver = _popen('bash -c "python -V"')
-if _python_ver:
- _python_ver = 'python' + _python_ver.split(" ")[1][0:3]
- _python_install_path = os.path.join(prefix, 'lib',
- _python_ver, 'site-packages')
+# finds the right place and does the right thing.
+
+# Unfortunately there's no way to get the config object from the
+# project to find out if we're building python3. We test the modules
+# list here but that's not really reliable because python3 might be
+# pulled in as a dependency by another module.
+
+# Note that this will break if there's an undetected python3 build and
+# the built python is a different major + minor version from the
+# virtenv one.
+if 'python3' in modules or 'meta-gtk-osx-python3' in modules:
+ os.environ['PYTHON'] = os.path.join(prefix, 'bin', 'python3')
+else:
+ _python_ver = sys.version_info.major * 10 + sys.version_info.minor
+ _python_install_path = os.path.join(prefix, 'lib', _python_ver, 'site-packages')
append_autogenargs('libxml2',
'--with-python-install-dir=' + _python_install_path)
environ_append('PYTHONPATH', _python_install_path, ':')
-os.environ['PYTHON'] = '/usr/bin/env python3'
+ os.environ['PYTHON'] = sys.executable
+
# Unset this so we don't mess with the check for not starting
# recursively.
os.unsetenv("JHB")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]