#494 closed defect (fixed)
Python exec dir is hardcoded
Reported by: | sadam | Owned by: | sascha_silbe |
---|---|---|---|
Priority: | Unspecified by Maintainer | Milestone: | Unspecified |
Component: | sugar-jhbuild | Version: | Git as of bugdate |
Severity: | Blocker | Keywords: | r? |
Cc: | Distribution/OS: | Unspecified | |
Bug Status: | New |
Description
On jaunty, I found I was unable to build any of the activities because sugar.activity couldn't be found. I discovered that sugar/activity.py was installed in install/lib/python2.6/dist-packages but that wasn't in my path (enter shell, execute python, import sys, print sys.path). Python 2.6 changes the exec directory in /usr/lib/pkgconfig/python2.6/pygtk-2.0.pc to
pyexecdir=${exec_prefix}/lib/python2.6/dist-packages
but /usr/lib/pkgconfig/python2.5/pygtk-2.0.pc has
pyexecdir=${exec_prefix}/lib/python2.5/site-packages
This logic is hardcoded in sjhbuild/config.py. Probably pkg-config should be used to set the appropriate directory in the path going forward.
Attachments (1)
Change History (14)
comment:1 Changed 14 years ago by tomeu
comment:2 Changed 14 years ago by sadam
Nope. It generalizes the path to the approriate version of python, but doesn't change that for 2.6 the pyexecdir is dist-packages instead of site-packages.
print sys.path
[, '/home/sadam/checkout/sugar-jhbuild/install/lib/python2.6/site-packages/gtk-2.0', '/home/sadam/checkout/sugar-jhbuild/install/lib/python2.6/site-packages', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']
~/checkout/sugar-jhbuild$ ls install/lib/python2.6/dist-packages/
abiword gtk-2.0 hippo.la hulahop pygtk.pth pygtk.pyc sugar
carquinyol hippo.a hippo.so jarabe pygtk.py pygtk.pyo
comment:3 Changed 14 years ago by tomeu
What about this?
diff --git a/sjhbuild/config.py b/sjhbuild/config.py index 4efe4e6..014dbec 100644 --- a/sjhbuild/config.py +++ b/sjhbuild/config.py @@ -1,5 +1,6 @@ import os import sys +from distutils import sysconfig import jhbuild.config @@ -55,18 +56,15 @@ class Config(jhbuild.config.Config): # We need to add the gtk-2.0 directory explicitly to # the Python path since '.pth' files (here pygtk.pth) # only work properly in system directories - pythonversion = 'python' + str(sys.version_info[0]) + '.' + \ - str(sys.version_info[1]) + python_packages = sysconfig.get_python_lib(0, 0, prefix='') if self.use_lib64: - pythonpath = os.path.join(self.prefix, 'lib64', pythonversion, - 'site-packages', 'gtk-2.0') - else: - pythonpath = os.path.join(self.prefix, 'lib', pythonversion, - 'site-packages', 'gtk-2.0') - jhbuild.config.addpath('PYTHONPATH', pythonpath) + python_packages = python_packages.split('/', 1)[1] + python_packages = os.path.join('lib64', python_packages) + python_packages = os.path.join(self.prefix, python_packages) + + jhbuild.config.addpath('PYTHONPATH', os.path.join(python_packages, 'gtk-2.0')) - python_lib = os.path.join(self.prefix, 'lib', 'python2.5', 'site-packages') - os.environ['PYTHON_LIB'] = python_lib + os.environ['PYTHON_LIB'] = python_packages if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: del os.environ['DBUS_SESSION_BUS_ADDRESS']
comment:4 Changed 14 years ago by erikos
- Bug Status changed from Unconfimed to New
- Component changed from sugar to sugar-jhbuild
- Owner changed from tomeu to marcopg
comment:5 Changed 14 years ago by erikos
- Owner changed from marcopg to tomeu
- Status changed from new to assigned
comment:6 Changed 14 years ago by tomeu
- Owner changed from tomeu to sascha_silbe
Sascha is our new jhbuild master ;)
comment:7 Changed 14 years ago by sascha_silbe
Using my new patch, I was able to compile "read" on Ubuntu jaunty / amd64 (which failed before) and Ubuntu intrepid / amd64 (worked before as well).
It needs testing for i386, though (both Python 2.5 and 2.6).
As jhbuild itself (i.e. the upstream project) has the same issue, my patch contains a workaround for that.
comment:8 Changed 14 years ago by sascha_silbe
There are several packages having Python 2.6 issues as well. Will file separate bugs.
comment:9 Changed 14 years ago by sascha_silbe
- Keywords r? added
comment:10 Changed 14 years ago by sascha_silbe
- Status changed from assigned to accepted
As #538 has been fixed, I could now verify correct operation of my patch and checked it in. Please try again (remove the entire "install" directory first).
Leaving this bug open for a second pair of eyes over my patch (AKA review).
comment:11 Changed 14 years ago by sadam
I can confirm this as fixed.
comment:12 Changed 14 years ago by sascha_silbe
I had to change the behaviour again to include both lib and lib64 for gtk-2.0 as different distros use different paths (lib64 on Fedora, lib on Debian-based). :-/
In git as commit 2d3c75cc829b7603d681fb08ec030523da28acb0 .
comment:13 Changed 14 years ago by sascha_silbe
- Resolution set to fixed
- Status changed from accepted to closed
Has been committed quite some time ago, closing without review now.
Can you check if this works?