views:

25

answers:

0

With Python 2.4 on Centos, when I create an RPM with setuptools (bdist_rpm), add it to my yum repository and install it with yum, the top-level Python packages are extracted and put directly in site-packages, along with a .egg-info directory for the full package. So, e.g., if spam-1.2.3 has a top-level package called "spam", then packaging and installing it as described results in this content added to the site-packages directory:

spam/
spam-1.2.3-py24.egg-info/

I would like to replicate this kind of behavior with a source dist and easy_install/pip in a virtualenv, but can't see any way to do it (without writing some kind of post-install script, etc.). Unfortunately the -e option of easy_install/pip doesn't really help me for one specific reason: my packages are Django applications that are bundled with static media files (images, css, js) which are intended to be served from Apache. I really do not want to manually create or manage symlinks or individual aliases to these files, but want to use a simple rule like:

AliasMatch ^/apps/([^/]+)/media/(.+) \
           /path-to-virtual-env/lib/python2.4/site-packages/$1/media/$2

This works with the RPM installs and with non-installed SVN checkouts. The idea of packaging my apps and installing them seems appealing, but with this difficulty, I'm not sure it's worth it. I'd love to hear any ideas, tips, tricks.