distutils: "build" command

Discussion in 'Python' started by TP, Mar 5, 2009.

  1. TP

    TP Guest

    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)
     
    TP, Mar 5, 2009
    #1
    1. Advertising

  2. En Thu, 05 Mar 2009 14:10:38 -0200, TP <>
    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
     
    Gabriel Genellina, Mar 6, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Giovanni Bajo
    Replies:
    0
    Views:
    390
    Giovanni Bajo
    Dec 16, 2005
  2. timw.google
    Replies:
    1
    Views:
    544
    Serge Orlov
    May 11, 2006
  3. Kirill Simonov
    Replies:
    2
    Views:
    318
    =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=
    Oct 9, 2006
  4. Anastasios Hatzis

    distutils: different names in src and dist/build

    Anastasios Hatzis, Feb 8, 2007, in forum: Python
    Replies:
    1
    Views:
    272
    Richard Jones
    Feb 8, 2007
  5. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,314
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
Loading...

Share This Page