Meta recipe script: Handle Python deb postinstall scripts correctly #161

probonopd opened this Issue Jan 1, 2017 · 1 comment


None yet

1 participant

probonopd commented Jan 1, 2017 edited

debian/Ubuntu Python packages are, imho, a confusing mess. There is .pth files that change the paths, stuff like /usr/share/pyshared, multiple different places where Python libraries can be placed, and as a result, more often than not, Python fails to find some includes.

Python packages, when installed on a debian/Ubuntu system, perform some postinstall scripts which is why simply unpacking them might leave us with unresolved paths. We would need to run the equivalent of them when we unpack python-* deb packages.

update-alternatives: using /usr/lib/wx/python/wx2.8.pth to provide /usr/lib/wx/python/wx.pth (wx.pth) in auto mode

Or, for python-numpy, there is the following postinstall script inside the package that calls update-python-modules:

set -e
# Automatically added by dh_pysupport
if which update-python-modules >/dev/null 2>&1; then
	update-python-modules  python-numpy.public
# End automatically added section

As a result, simply unpacking the numpy package is not sufficient.

This is quite black magic to me; help would be greatly appreciated.

@probonopd probonopd changed the title from Meta recipe script: Handle Python correctly to Meta recipe script: Handle Python deb postinstall scripts correctly Jan 1, 2017

Only halfway related, on a debian/Ubuntu system, there is a file /var/lib/dpkg/info/python-minimal.postinst. It calls

python2.7 -m compileall /usr/share/python/ >/dev/null

This compiles a whole directory tree from py to pyc. Maybe we should run that, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment