ubuntu, distutils, site-packages vs dist-packages

January 14, 2010

in linux,software

I’ve been working on getting cobbler to play well on ubuntu, and got frustrated when trying to generate a .deb package for it. It seemed that no matter what I did, the python distutils/setuptools wanted to cram the generated python libraries into a “site-packages” dir, rather than a “dist-packages” dir (be it under /usr or /usr/local). I wanted the cobbler packages to end up in /usr/lib/python2.6/dist-packages, but I didn’t want to hook into the debuild scripts and do some hackish file copies, moves, or symlinks.
Luckily, after peering into the setuptools python source, I discovered an installation arg that solved my problem (in command/easy_install.py):

83
('install-layout=', None, "installation layout to choose (known values: deb)")

Vague and not well document, but the “deb” value started to make me feel warm and fuzzy. Gave it a shot and it works! Here’s the snippet from my makefile:

47
48
debinstall: manpage
        python setup.py install -f --root $(DESTDIR) --install-layout=deb

Cheers!

{ 1 comment… read it below or add one }

Mike Diehn March 17, 2010 at 3:37 pm

Thanks, man. Been unwittingly using the ancient gdata package that synaptic installs because I didn’t know that the 2.0.5 and 2.0.9 versions I’d “installed” weren’t being seen. Ugh. Your post solved a nice bunch of problems for me.

Leave a Comment

Previous post:

Next post: