[Distutils] Python Deb Packages

Piotr Ozarowski ozarow at gmail.com
Thu Nov 18 14:10:35 CET 2010

[Damian Johnson, 2010-11-17]
> > --install-lib=/usr/share/yourpackagename/ --install-data=/usr/share/yourpackagename/
> > (and maybe --install-scripts=/usr/share/yourpackagename/) should do the
> > right thing
> Unfortunately not quite. Passing those flags results in:
> /usr/share/arm/arm/<package's contents>
> /usr/share/arm/arm-1.3.7_dev.egg-info

... and that's perfectly fine (if the first "arm" is (Debian) package name)

> The egg-info metadata only has relevance if this was being installed
> to pyshared so ideally it should be omitted and the package contents
> just installed to:
> /usr/share/arm/<package's contents>

You can remove it in debian/rules (see below) if you want (if it's not
used in the module), keeping it shouldn't harm, though

> Setting "--install-lib=/usr/share" adds my package to the right
> location, but also includes "/usr/share/arm-1.3.7_dev.egg-info" which
> causes a lintian error. A couple quick questions:

What if package foo will install private module "arm" in /usr/share/ as
well? Please don't do that unless there's a really good reason to take
over a namespace

> - If private python modules aren't supposed to be living in
> '/usr/share/pyshared' then shouldn't distutil include an option to
> omit the egg-info metadata?

Are you sure this data isn't used? An option to disable .egg-info
file/directory generation would be nice, though.
> - Any ideas you have for how to remove the egg-info during debian
> builds would be much appreciated.

How about something like this (I didn't test it):

| #!/usr/bin/make -f
| %:
| 	dh $@ --with python2
| override_dh_auto_install:
| 	python setup.py install --install-lib=/usr/share/foo/ --install-data=/usr/share/foo/ --install-scripts=/usr/share/foo/
|       dh_link /usr/share/foo/myscript /usr/bin/myscript
| 	rm -rf debian/foo/usr/share/foo/arm*info

replace foo with [Debian] binary package name; instead of dh_link line
you can add debian/links file
Piotr Ożarowski                         Debian GNU/Linux Developer
www.ozarowski.pl          www.griffith.cc           www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645

More information about the Distutils-SIG mailing list