problem writing setup script

Discussion in 'Python' started by Christian Meesters, Sep 24, 2007.

  1. Hi

    I have the following file structure

    MANIFEST
    README
    INSTALL -- all text
    setup.py
    src/
    __init__.py
    foo.py
    for_ext.pyx

    and this setup-script:

    import sys
    from distutils.core import setup
    from distutils.extension import Extension
    try:
    from Pyrex.Distutils import build_ext
    except ImportError:
    __info__ = """
    Please install Pyrex
    (http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/)
    before running this setup script.
    """
    sys.exit(__info__)

    setup(
    name = "foo",
    # snip
    packages = ['foo'],
    package_dir={'foo': 'src/'},
    package_data = {'foo': ['README', 'INSTALL']},
    ext_package='foo_ext',
    ext_modules = [
    Extension("foo_ext", ["src/foo_ext.pyx"])
    ],
    cmdclass = {'build_ext' : build_ext}
    )

    Typing
    sudo python setup.py
    runs without warning, however, this results in a file
    /usr/lib/python2.5/site-packages/foo/foo.py , which I only can import like
    import foo.foo
    and not
    import foo
    in order to access foo's namespace.
    Furhtermore a file foo_ext.so will be created
    in /usr/lib/python2.5/site-packages, but I would like to see it
    in /usr/lib/python2.5/site-packages/foo, since importing foo_ext.so only
    makes sense for foo.

    Does anybody know how I should change my file structure or the setup-script
    to achieve those two goals?

    TIA
    Christian
     
    Christian Meesters, Sep 24, 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. R.A.M.
    Replies:
    0
    Views:
    285
    R.A.M.
    Dec 5, 2006
  2. Chris Shenton
    Replies:
    1
    Views:
    1,485
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Aug 24, 2007
  3. bona
    Replies:
    0
    Views:
    229
  4. Intransition

    [ANN] Ruby Setup 5 (setup.rb)

    Intransition, Jan 13, 2010, in forum: Ruby
    Replies:
    0
    Views:
    439
    Intransition
    Jan 13, 2010
  5. Benoit Fries
    Replies:
    1
    Views:
    85
    Thomas 'PointedEars' Lahn
    Nov 14, 2003
Loading...

Share This Page