distutils: "build" command

T

TP

Hi everybody,

I have programmed a python package, and I would like to use distutils with
it. My package has the following structure after doing sdist and build:

$ python setup.py sdist
[...]
$ python setup.py build
[...]
$ tree
..
|-- MANIFEST
|-- MANIFEST.in
|-- README
|-- build
| `-- lib
| `-- utils
| |-- __init__.py
| `-- __init__.pyc
|-- dist
| `-- utils-1.0.tar.gz
|-- utils
| |-- __init__.py
| |-- __init__.pyc
| |-- utils_1
| | |-- __init__.py
| | |-- __init__.pyc
| | `-- toto.py
| `-- utils2
| |-- __init__.py
| `-- foo.py
`-- setup.py

So, in the "build" directory, I do not get all the the modules ("utils1"
and "utils2" directory), but only the first level of the package (files
under "utils" directory). Whereas all the files are included in the
utils-1.0.tar.gz archive made with "sdist".
How to modify setup.py and/or MANIFEST.in to include all the subdirectories
in the "build" directory when doing "setup.py build"? I have googled a bit
without finding anything.
These are my MANIFEST.in and setup.py files:

$ cat MANIFEST.in
include README
recursive-include utils *.py

$ cat setup.py
from distutils.core import setup

setup( name = 'utils'
, version = '1.0'
, url = ''
, author = ''
, author_email = ''
, packages = [ 'utils' ] )

Thanks in advance

--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
 
G

Gabriel Genellina

Hi everybody,

I have programmed a python package, and I would like to use distutils
with
it. My package has the following structure after doing sdist and build:

$ python setup.py sdist
[...]
$ python setup.py build
[...]
$ tree
.
|-- MANIFEST
|-- MANIFEST.in
|-- README
|-- build
| `-- lib
| `-- utils
| |-- __init__.py
| `-- __init__.pyc
|-- dist
| `-- utils-1.0.tar.gz
|-- utils
| |-- __init__.py
| |-- __init__.pyc
| |-- utils_1
| | |-- __init__.py
| | |-- __init__.pyc
| | `-- toto.py
| `-- utils2
| |-- __init__.py
| `-- foo.py
`-- setup.py

So, in the "build" directory, I do not get all the the modules ("utils1"
and "utils2" directory), but only the first level of the package (files
under "utils" directory). Whereas all the files are included in the
utils-1.0.tar.gz archive made with "sdist".

You have to explicitely enumerate all packages. See the last paragraph
here:
http://docs.python.org/distutils/setupscript.html#listing-whole-packages

"Keep in mind that although package_dir applies recursively, you must
explicitly list all packages in packages: the Distutils will not
recursively scan your source tree looking for any directory with an
__init__.py file."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top