[Distutils] Why do I get 3 copies of my files from this simple Distutils setup.py?

Taylor, Martin cmtaylor at ti.com
Thu May 5 22:36:02 CEST 2005


On my WinXP PC I have the following file structure:

C:\FOO\setup.py
C:\FOO\Bar\BarConstants.py
C:\FOO\Bar\Bar.py

The contents of \FOO\setup.py are as follows:

setup(name="FOO",
	version="4.2.3",
      package_dir={"FOO.Bar" : "Bar"},
      packages=["FOO.Bar"],
	author="C. Martin Taylor",
	author_email="cmtaylor at ti.com"
      )

When I run this setup.py to build a "bdist" I get the following output:

C:\FOO>python setup.py bdist --format=zip
running bdist
running bdist_dumb
running build
running build_py
package init file 'Bar\__init__.py' not found (or not a regular file)
package init file 'Bar\__init__.py' not found (or not a regular file)
installing to build\bdist.win32\dumb
running install
running install_lib
creating build\bdist.win32\dumb
creating build\bdist.win32\dumb\Python24
creating build\bdist.win32\dumb\Python24\Lib
creating build\bdist.win32\dumb\Python24\Lib\site-packages
copying build\lib\BarConstants.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages
creating build\bdist.win32\dumb\Python24\Lib\site-packages\Bar
copying build\lib\Bar\BarConstants.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages\Bar
copying build\lib\Bar\Bar.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages\Bar
copying build\lib\Bar.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages
creating build\bdist.win32\dumb\Python24\Lib\site-packages\FOO
creating build\bdist.win32\dumb\Python24\Lib\site-packages\FOO\Bar
copying build\lib\FOO\Bar\BarConstants.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages\FOO\Bar
copying build\lib\FOO\Bar\Bar.py ->
build\bdist.win32\dumb\Python24\Lib\site-packages\FOO\Bar
byte-compiling
build\bdist.win32\dumb\Python24\Lib\site-packages\BarConstants.py to
BarConstants.pyc
byte-compiling
build\bdist.win32\dumb\Python24\Lib\site-packages\Bar\GUIConstants.py to
BarConstants.pyc
byte-compiling
build\bdist.win32\dumb\Python24\Lib\site-packages\Bar\Bar.py to Bar.pyc
byte-compiling build\bdist.win32\dumb\Python24\Lib\site-packages\Bar.py
to GUITest.pyc
byte-compiling
build\bdist.win32\dumb\Python24\Lib\site-packages\FOO\Bar\BarConstants.p
y to BarConstants.pyc
byte-compiling
build\bdist.win32\dumb\Python24\Lib\site-packages\FOO\Bar\Bar.py to
Bar.pyc
creating 'C:\FOO\dist\FOO-4.2.3.win32.zip' and adding '.' to it
adding 'Python24\Lib\site-packages\BarConstants.py'
adding 'Python24\Lib\site-packages\BarConstants.pyc'
adding 'Python24\Lib\site-packages\Bar.py'
adding 'Python24\Lib\site-packages\Bar.pyc'
adding 'Python24\Lib\site-packages\Bar\BarConstants.py'
adding 'Python24\Lib\site-packages\Bar\BarConstants.pyc'
adding 'Python24\Lib\site-packages\Bar\Bar.py'
adding 'Python24\Lib\site-packages\Bar\Bar.pyc'
adding 'Python24\Lib\site-packages\FOO\Bar\BarConstants.py'
adding 'Python24\Lib\site-packages\FOO\Bar\BarConstants.pyc'
adding 'Python24\Lib\site-packages\FOO\Bar\Bar.py'
adding 'Python24\Lib\site-packages\FOO\Bar\Bar.pyc'
removing 'build\bdist.win32\dumb' (and everything under it)

My question is why am I getting 3 copies of the 2 Python files I'm
trying to distribute, one copy in \Python24\Lib\site-packages\, one in
\Python24\Lib\site-packages\Bar\ and one in
\Python24\Lib\site-packages\FOO\Bar\?  The only copy I want is the last
one!

This is my first attempt at using Distutils so any help and explanations
would be appreciated. (I really don't want to make FOO.Bar into a "real"
Python package with an __init__.py module, so please don't suggest
that.)

Thank you,

Martin Taylor


More information about the Distutils-SIG mailing list