Installing single module from src directory
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"], ) Then, distutils does the following when running setup.py: Macintosh:mymodule dinu$ py252 setup.py build running build running build_py creating build creating build/lib creating build/lib/src copying src/mymodule.py -> build/lib/src And of course, I get the following structure built: Macintosh:mymodule dinu$ tree2.py -f build build/ | lib/ | | src/ | | | mymodule.py And sure enough I don't want the "src" level. I can get rid of it, but only after moving mymodule.py into the the main project directory, and removing the "src/" in py_modules. Instead, what I would *really* like is some smart combination of setup parameters that would just do it. But so far, all my efforts in finding combinations of py_modules, packages, package_dir (dummy/fake package) and even package_data does not do the trick. Now I'm desperately looking for a distutils "Houdini" on this list. Regards, Dinu
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'} )
participants (2)
-
Dinu Gherman
-
Phillip J. Eby