setup.py build & SWIG: missing py files (they are outside the build directory)

Discussion in 'Python' started by mauro, Oct 10, 2007.

  1. mauro

    mauro Guest

    Hi all,
    I am trying to make a package distribution containing some extension
    module written in C. The problem is that when I run setup.py some
    files are generated in the wrong position.
    Suppose that this is my setup.py:

    from distutils.core import setup, Extension

    setup(name='foo',
    package_dir = {"foo" : "src"},
    packages=['foo',
    'foo.spam',
    ],
    ext_modules=[
    Extension("foo.spam._spam",
    sources=['src/spam/spam.i',
    'src/spam/spam.cc',
    ],
    )
    ]
    )

    Here is an example of what I get after running:

    python setup.py build -cmingw32 bdist

    ..\
    +build\
    +lib.win32-2.4\
    +foo\
    +spam\
    __init__.py
    _spam.pyd
    __init__.py
    foo.py
    +src\
    +dist\
    foo-0.0.win32.zip
    setup.py
    spam.py

    So the problem is that spam.py (generated by SWIG) is not in .\build
    \lib.win32-2.4\foo\spam but in the same directory as setup.py!
    Of course I can move it manually, but I have to update also
    foo-0.0.win32.zip and all this is quite annoying...
    Did I miss some option in the setup? Is it possible to run a system
    command (copy) after each extension is compiled and linked and the
    corresponding .py file is generated?
    Thanks in advance!

    Mauro
     
    mauro, Oct 10, 2007
    #1
    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. Asfand Yar Qazi
    Replies:
    4
    Views:
    430
    Asfand Yar Qazi
    Nov 12, 2004
  2. Martin M.
    Replies:
    4
    Views:
    367
    Simon Brunning
    Dec 15, 2005
  3. Dave Rudolf
    Replies:
    1
    Views:
    316
    Kai-Uwe Bux
    May 17, 2006
  4. David A. Black
    Replies:
    2
    Views:
    241
    Tim Hunter
    Aug 19, 2004
  5. Krzysztof Poc

    outside type, outside function

    Krzysztof Poc, Feb 3, 2012, in forum: C++
    Replies:
    1
    Views:
    313
    Victor Bazarov
    Feb 7, 2012
Loading...

Share This Page