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





On Jan 9, 2022, at 4:40 AM, Pascal <p p14 orange fr> wrote:


Le 8 janv. 2022 à 15:26, Pascal <p p14 orange fr> a écrit :

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,

I went too fast on that changes, GTK build is broken, so I propose to merge both environnements if Python3 is installed in prefix:

+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)
+    _python_ver = str(sys.version_info.major) + '.' + str(sys.version_info.minor)
+    _python_install_path = os.path.join(prefix, 'lib', 'python' + _python_ver,
+                                        'site-packages')
+    environ_append('PYTHONPATH', _python_install_path, ':')
+    _python_library_path = os.path.join(os.environ['PYENV_ROOT'], 'versions',
+                                       os.environ['PYENV_VERSION'], 'lib')
+    environ_append('LDFLAGS', '-L' + _python_library_path)
+    os.environ['PYTHON'] = sys.executable
+    del python_version

Is it not too much confusing?


Definitely too confusing, see my comment on the other thread.

Regards,
John Ralls




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