distutils: "build" command

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 5 19:28:18 EST 2009


En Thu, 05 Mar 2009 14:10:38 -0200, TP <Tribulations at paralleles.invalid>  
escribió:

> 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."

-- 
Gabriel Genellina




More information about the Python-list mailing list