[jhbuild/wip/muktupavels/python-dist-packages] sitecustomize: add also dist-packages path




commit b392bfe8c7fd3277f648d6cc0999d80c6f0959cd
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jun 18 15:33:43 2022 +0300

    sitecustomize: add also dist-packages path
    
    Otherwise Python won't find modules that are built by JHBuild and
    installed into JHBUILD_PREFIX/lib/python3/dist-packages.

 examples/jhbuild-session               | 3 +--
 jhbuild/sitecustomize/sitecustomize.py | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/examples/jhbuild-session b/examples/jhbuild-session
index fc4ff4d6..01ade781 100755
--- a/examples/jhbuild-session
+++ b/examples/jhbuild-session
@@ -4,7 +4,7 @@ GNOME=/opt/gnome
 
 PATH=${GNOME}/bin:${GNOME}/sbin:${PATH}
 LD_LIBRARY_PATH=${GNOME}/lib:${LD_LIBRARY_PATH}
-PYTHONPATH=${GNOME}/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages
+PYTHONPATH=${GNOME}/lib/python3.10/site-packages:${GNOME}/lib/python3/dist-packages:/usr/lib/python3.10/site-packages
 PKG_CONFIG_PATH=${GNOME}/lib/pkgconfig:${GNOME}/share/pkgconfig:/usr/lib/pkgconfig
 XDG_DATA_DIRS=${GNOME}/share:/usr/share
 XDG_CONFIG_DIRS=${GNOME}/etc/xdg
@@ -18,4 +18,3 @@ systemctl --user daemon-reload
 
 #exec valgrind --tool=memcheck --log-file=/tmp/session-grind.log "${GNOME}/bin/gnome-session"
 exec "${GNOME}/bin/gnome-session" --debug
-
diff --git a/jhbuild/sitecustomize/sitecustomize.py b/jhbuild/sitecustomize/sitecustomize.py
index 4ae2a770..127aed68 100644
--- a/jhbuild/sitecustomize/sitecustomize.py
+++ b/jhbuild/sitecustomize/sitecustomize.py
@@ -2,6 +2,9 @@ from distutils import sysconfig
 import sys
 import os
 
+if 'JHBUILD_PREFIX' in os.environ:
+    sys.path.insert(1, os.environ['JHBUILD_PREFIX'] + '/lib/python3/dist-packages')
+
 if 'JHBUILD_PREFIXES' in os.environ:
     for prefix in reversed(os.environ['JHBUILD_PREFIXES'].split(':')):
         sitedir = sysconfig.get_python_lib(prefix=prefix)


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