[Distutils] Package different sets of files with sdist and bdist

Aryeh Leib Taurog python at aryehleib.com
Tue Feb 4 21:52:39 CET 2014


I'm working on a django app, which I'd like to be able to package with 
setuptools.  I use sass/compass, coffeescript, and hamlpy, among other 
tools to generate supporting static content for my app.

I think my build/deploy process should look like this:

 1. On my development machine:

    [dev] $ python setup.py sdist

    This would create a tarball of all my sources,
    mainly *.py, *.iced, *.haml, *.sass, and one *.pyx

 2. On a build machine:

    [build] $ compass compile mypkg/static       # compile sass to css
    [build] $ coffee --compile -o mypkg/js mypkg/coffee  # compile coffee
    [build] $ python setup.py bdist_wheel

    This would create a binary wheel with my c-extension and all my 
    static content compiled.

 3. Deploy:

    [www] $ pip install mypkg-1.0-cp27-none-linux_x86_64.whl

The problem is that there doesn't seem to be any easy way to include 
only the *.coffee and *.sass files in the sdist and only the *.js and 
*.css files in the bdist, short of deleting the files I want to 
exclude at each stage prior to running setup.py, which I'd rather not 
do.

I'm using setuptools with VCS support and include_package_data=True.

Is there any way to do this, or a more pythonic workflow to accomplish 
the same goal?

Thanks,
Aryeh Leib Taurog


More information about the Distutils-SIG mailing list