6

I have a project with this structure:

SomeProject/
    bin/
    CHANGES.txt
    docs/
    LICENSE.txt
    MANIFEST.in
    README.txt
    setup.py
    someproject/
        __init__.py
        location.py
        utils.py
        static/
            javascript/
                somescript.js

And a "setup.py" as follows:

#!/usr/bin/env python

import someproject
from os.path import exists
try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

setup(
    name='django-some-project',
    version=someproject.__version__,
    maintainer='Some maintainer',
    maintainer_email='some@manteiner.com',
    packages=find_packages(),
    include_package_data=True,
    scripts=[],
    url='https://github.com/xxx/some-project',
    license='LICENSE',
    description='Some project description.',
    long_description=open('README.markdown').read() if exists("README.markdown") else "",
    install_requires=[
        "Django >= 1.4.0"
    ],
)

Then, when I upload it using the command:

python setup.py sdist upload

It seems ok, but there is no "static" folder with this "javascript" subfolder in the package. My "setup.py" was inspired on github.com/maraujop/django-crispy-forms that has a similar structure. Any hint on what is wrong on uploading this subfolders?

staticdev
  • 2,950
  • 8
  • 42
  • 66

2 Answers2

4

You should be able to add those files to source distributions by editing the MANIFEST.in file to add a line like:

recursive-include someproject/static *.js

or just:

include someproject/static/javascript/*.js

This will be enough to get the files included in source distributions. If the setuptools include_package_data option you're using isn't enough to get the files installed, you can ask for them to be installed explicitly with something like this in your setup.py:

package_data={'someproject': ['static/javascript/*.js']},
James Henstridge
  • 42,244
  • 6
  • 132
  • 114
  • 1
    James, I made some progress with your answer. The files were missing in the package after upload, now the are all in the tar.gz file. BUT, when I pip install the package, the files disappear again! – staticdev Mar 27 '13 at 02:02
3

Use following

packages = ['.','templates','static','docs'],

package_data={'templates':['*'],'static':['*'],'docs':['*'],},
Dadaso Zanzane
  • 6,039
  • 1
  • 25
  • 25