10

I have this project:

.
├── django_mysetup
│   ├── __init__.py
│   ├── template-basket
│   │   └── apple
│   │       ├── app_template
│   │       │   ├── forms.py
│   │       │   ├── __init__.py
│   │       │   ├── models.py
│   │       │   ├── tests.py
│   │       │   └── views.py
│   │       └── project_template
│   │           ├── manage.py
│   │           └── project_name
│   │               ├── __init__.py
│   │               ├── settings.py
│   │               ├── urls.py
│   │               └── wsgi.py
│   └── templates
│       ├── example_direct.html
│       ├── example.html
│       └── stylesheets
│           ├── base.css
│           ├── layout.css
│           └── skeleton.css
├── MANIFEST.in
├── README.rst
└── setup.py

This is the setup.py file:

from distutils.core import setup

setup(
    name='Django_mysetup',
    py_modules=['django_mysetup'],
    entry_points={
    'console_scripts': ['django_mysetup = django_mysetup:main', ],},
    description='A Personalised Django startproject and startapp setup script.',
    long_description=open('README.rst').read(),
    packages=['django_mysetup'],
    package_data={'django_mysetup': ['templates/*', 'templates/stylesheets/*',
      'template-basket/apple/app_template/*', 
      'template-basket/apple/project_template/*', 
      'template-basket/apple/project_template/project_name/*',
      'template-basket/apple/project_template/manage.py'
      ]}
)

This is the MANIFEST.in file (the MANIFEST generation template)

include README.rst
recursive-include template-basket *
recursive-include templates *

When I do python setup.py sdist and pip install the *.tar.gz file to my virtualenv, I get this:

error: can't copy 'Django-mysetup/templates/stylesheets': doesn't exist or not a regular file

So the problem is in package_data.

How do I adjust my setup.py script so the template-basket and templates dirs with all their contents are installed in my virtual environment? (Preferably in a way where I don't need to write every single file in those dirs, just the top dir names.)

Zearin
  • 1,474
  • 2
  • 17
  • 36
Bentley4
  • 10,678
  • 25
  • 83
  • 134
  • Are the stylesheets included in `MANIFEST.in`? – Vikas Nov 08 '12 at 12:28
  • I updated the original post so you can see the contents of `MANIFEST.in`. I did a recursive include, so that should be ok. – Bentley4 Nov 08 '12 at 12:33
  • Doesn't look like there is anything wrong. I created the same dir structure, touched files and used MANIFEST.in, setup.py as you have in the post. It worked just fine. – Vikas Nov 08 '12 at 13:04
  • If the code is under version control, you can probably try `setuptools` from [Distribute](http://packages.python.org/distribute/setuptools.html). This has a `include_package_data` parameter. If this parameter is set to `True` then all files under version control is included. No need to use `MANIFEST.in`. – Vikas Nov 08 '12 at 13:31

0 Answers0