[gtk-osx-users] LibXML2 site-packages configuration.



Hello,

As the jhbuild Python version has changed to 3.10 and moduleset Python version is still 3.9, when building 
Python and GTK, LibXML2 is puzzled to find the good site-packages folder.

/usr/local/xnadalib-2021/lib/python3.9/site-packages
and
/usr/local/xnadalib-2021/lib/python3.10/site-packages
are both present in prefix.

LibXML2 is installed in the latter :-(

I propose some changes:

+++ ./jhbuildrc 2022-01-08 13:21:29.000000000 +0100
@@ -23,6 +23,7 @@
 import sys
 import errno
 import re
+import subprocess
 
 #some variables we'll need defined later
 _default_arch = ""
@@ -620,6 +622,18 @@
     'pygments' in modules):
     os.environ['PYTHON'] = os.path.join(prefix, 'bin', 'python3')
     module_extra_env['pkg-config'] = {'PYTHON':sys.executable}
+elif os.path.isfile (os.path.join(prefix, 'bin', 'python3')):
+    python_version = subprocess.Popen([os.path.join(prefix, 'bin', 'python3'), "--version"], 
stdout=subprocess.PIPE).stdout.read()
+    _python_ver = re.search(r"Python ([0-9]+[.][0-9]+)[.]", python_version.decode('utf-8')).group(1)
+    _python_install_path = os.path.join(prefix, 'lib', 'python' + _python_ver,
+                                        'site-packages')
+    append_autogenargs('libxml2',
+                       '--with-python-install-dir=' + _python_install_path)
+    environ_append('PYTHONPATH', _python_install_path, ':')
+    _python_library_path = os.path.join(prefix, 'lib')
+    environ_append('LDFLAGS', '-L' + _python_library_path)
+    os.environ['PYTHON'] = os.path.join(prefix, 'bin', 'python3')
+    del python_version
 else:
     _python_ver = str(sys.version_info.major) + '.' + str(sys.version_info.minor)
     _python_install_path = os.path.join(prefix, 'lib', 'python' + _python_ver,

Maybe some cleanup is also needed.

What is your feedback?

Thanks, Pascal.
https://blady.pagesperso-orange.fr




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]