[Distutils] Installing single module from src directory

Phillip J. Eby pje at telecommunity.com
Wed Oct 1 19:30:46 CEST 2008


At 02:10 PM 10/1/2008 +0200, Dinu Gherman wrote:
>Hi,
>
>I've been using distutils for a while now, but today I'm running
>into what seems to be the "minimal strange issue". I want to in-
>stall a single Python module without anything else, no package
>around it, which resides in a source subdirectory of the main
>project directory. My layout looks like the following:
>
>   Macintosh:Python dinu$ tree2.py -f mymodule
>   mymodule/
>   |  setup.py
>   |  src/
>   |  |  mymodule.py
>
>Now common sense says all I need to do is define the module in
>setup.py like this:
>
>   Macintosh:mymodule dinu$ more setup.py
>   from distutils.core import setup
>
>   setup(
>       py_modules = ["src/mymodule"],
>   )

Actually, you want:

    setup(
        py_modules = ['mymodule'],
        package_dir = {'': 'src'}
    )



More information about the Distutils-SIG mailing list