[Build-common-hackers] Bug#587240: python installs to site-packages but with 2.6 they are not in sys.path

Steffen Moeller steffen_moeller at gmx.de
Sat Jun 26 14:39:47 UTC 2010


Package: cdbs
Version: 0.4.87
Severity: important

Hello,

I am browsing documentation and source and it seems like 
/usr/share/cdbs/1/class/python-distutils.mk
is somewhat stuck with python 2.5 where the site-packages
are part of the system path. With 2.6 this is no longer the
case but I want my python packages to be visible for all
without the need to 
export PYTHONPATH=/usr/lib/python2.6/site-packages

Here the proof:
$ python2.6
Python 2.6.5+ (release26-maint, Jun 16 2010, 09:20:52) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print sys.path
['', '/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/PIL', '/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']

If I am not erroneous, then the package should instead go to /usr/lib/python2.6/dist-packages by default. The following patch to /usr/share/cdbs/1/class/python-distutils.mk has fixed this for me:

--- python-distutils.mk.orig	2010-06-26 14:52:18.000000000 +0200
+++ python-distutils.mk	2010-06-26 16:34:41.000000000 +0200
@@ -74,14 +74,20 @@
 
 # install stage
 $(patsubst %,install/%,$(cdbs_python_indep_packages)) :: install/%: python-install-py
+	subdir=dist-packages ; \
+	if [ "2.5" == "$(cdbs_python_primary_versionsub)" -o "2.4" == "$(cdbs_python_primary_versionsub)" ]; then \
+		subdir=site-packages ; \
+	fi ; \
 	cd $(DEB_SRCDIR) && python$(cdbs_python_nondefault_version) $(DEB_PYTHON_SETUP_CMD) install --root=$(cdbs_python_destdir) \
-		--install-purelib=/usr/lib/python$(cdbs_python_primary_version)/site-packages/ $(DEB_PYTHON_INSTALL_ARGS_ALL)
+		--install-purelib=/usr/lib/python$(cdbs_python_primary_version)/$$subdir/ $(DEB_PYTHON_INSTALL_ARGS_ALL)
 
 $(patsubst %,install/%,$(cdbs_python_arch_packages)) :: install/%: $(addprefix python-install-, $(cdbs_python_build_versions))
 	set -e; for buildver in $(cdbs_python_build_versions); do \
+		subdir=dist-packages ; \
+		if [ "2.5" == "$$buildver" -o "2.4" == "$$buildver" ]; then subdir=site-packages ; fi ; \
 		cd $(CURDIR) && cd $(DEB_SRCDIR) && $(call cdbs_python_binary,python$$buildver) $(DEB_PYTHON_SETUP_CMD) install \
-		--root=$(cdbs_python_destdir) --install-purelib=/usr/lib/python$$buildver/site-packages/ \
-		--install-platlib=/usr/lib/python$$buildver/site-packages/ $(DEB_PYTHON_INSTALL_ARGS_ALL); \
+		--root=$(cdbs_python_destdir) --install-purelib=/usr/lib/python$$buildver/$$subdir/ \
+		--install-platlib=/usr/lib/python$$buildver/$$subdir/ $(DEB_PYTHON_INSTALL_ARGS_ALL); \
 	done
 
 # Deprecated targets.  You should use above targets instead.


Many thanks

Steffen

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cdbs depends on:
ii  debhelper                     7.9.1      helper programs for debian/rules

Versions of packages cdbs recommends:
ii  autotools-dev                 20100122.1 Update infrastructure for config.{

Versions of packages cdbs suggests:
ii  devscripts                    2.10.64    scripts to make the life of a Debi
ii  doc-base                      0.9.5      utilities to manage online documen

-- no debconf information





More information about the Build-common-hackers mailing list