Robert Kern wrote: > Steven Bethard wrote: >> Robert Kern wrote: >>> Steven Bethard wrote: >>>> How do I get distutils to include my testing module in just the "sdist" >>>> distribution? >>> Use a MANIFEST. >>> >>> http://docs.python.org/dist/source-dist.html > > Also, I just noted this tidbit: > > """If you don't supply an explicit list of files (or instructions on how to > generate one), the sdist command puts a minimal default set into the source > distribution: > ... > * anything that looks like a test script: test/test*.py (currently, the > Distutils don't do anything with test scripts except include them in source > distributions, but in the future there will be a standard for testing Python > module distributions) > ... > """ > > So you can just stick test_argparse.py into a test/ directory. Having tested > this, it appears to work (see below).
Yeah, I was trying to avoid having to put it in a test/ directory. When they're in the same directory, I can just run test_argparse.py and it tests the local one instead of the one I have installed in site-packages. When it's in a test/ directory, running test/test_argparse.py tests the one in site-packages. I did try putting test_argparse.py in a test/ directory though, and it doesn't seem to solve the problem -- test_argparse.py gets put into site-packages with the "bdist" command: > python setup.py sdist running sdist warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) writing manifest file 'MANIFEST' creating argparse-0.6.0 creating argparse-0.6.0\test copying files to argparse-0.6.0... copying README.txt -> argparse-0.6.0 copying argparse.py -> argparse-0.6.0 copying setup.py -> argparse-0.6.0 copying test\test_argparse.py -> argparse-0.6.0\test creating 'dist\argparse-0.6.0.zip' and adding 'argparse-0.6.0' to it adding 'argparse-0.6.0\argparse.py' adding 'argparse-0.6.0\PKG-INFO' adding 'argparse-0.6.0\README.txt' adding 'argparse-0.6.0\setup.py' adding 'argparse-0.6.0\test\test_argparse.py' removing 'argparse-0.6.0' (and everything under it) > python setup.py bdist_dumb running bdist_dumb running build running build_py installing to build\bdist.win32\dumb running install running install_lib creating build\bdist.win32\dumb creating build\bdist.win32\dumb\Program Files creating build\bdist.win32\dumb\Program Files\Python creating build\bdist.win32\dumb\Program Files\Python\Lib creating build\bdist.win32\dumb\Program Files\Python\Lib\site-packages copying build\lib\argparse.py -> build\bdist.win32\dumb\Program Files\Python\Lib\site-packages copying build\lib\test_argparse.py -> build\bdist.win32\dumb\Program Files\Python\Lib\site-packages byte-compiling build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\argparse.py to argparse.pyc byte-compiling build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\test_argparse.py to test_argparse.pyc running install_egg_info Writing build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\argparse-0.6.0-py2.5.egg-info creating 'dist\argparse-0.6.0.win32.zip' and adding '.' to it adding 'Program Files\Python\Lib\site-packages\argparse-0.6.0-py2.5.egg-info' adding 'Program Files\Python\Lib\site-packages\argparse.py' adding 'Program Files\Python\Lib\site-packages\argparse.pyc' adding 'Program Files\Python\Lib\site-packages\test_argparse.py' adding 'Program Files\Python\Lib\site-packages\test_argparse.pyc' removing 'build\bdist.win32\dumb' (and everything under it) >> Using a MANIFEST appears to do the same thing as putting "test_argparse" >> into py_modules -- that is, it puts "test_argparse.py" into both "sdist" >> and "bdist" distributions. In "bdist" distributions it gets installed to >> the site-packages directory like any other module. > > Are you sure that you don't have changes left over in your setup.py when you > tested that? Yep. (Though I still cleared everything out and tried it again.) Here's what I got using an unmodified setup.py and the MANIFEST.in you suggested. Note that the "bdist" version is putting test_argparse.py into site-packages. > type MANIFEST.in include PKG-INFO include *.txt include *.py > python setup.py sdist running sdist reading manifest template 'MANIFEST.in' warning: no files found matching 'PKG-INFO' writing manifest file 'MANIFEST' creating argparse-0.6.0 copying files to argparse-0.6.0... copying LICENSE.txt -> argparse-0.6.0 copying README.txt -> argparse-0.6.0 copying argparse.py -> argparse-0.6.0 copying setup.py -> argparse-0.6.0 copying test_argparse.py -> argparse-0.6.0 creating 'dist\argparse-0.6.0.zip' and adding 'argparse-0.6.0' to it adding 'argparse-0.6.0\argparse.py' adding 'argparse-0.6.0\LICENSE.txt' adding 'argparse-0.6.0\PKG-INFO' adding 'argparse-0.6.0\README.txt' adding 'argparse-0.6.0\setup.py' adding 'argparse-0.6.0\test_argparse.py' removing 'argparse-0.6.0' (and everything under it) > python setup.py bdist_dumb running bdist_dumb running build running build_py installing to build\bdist.win32\dumb running install running install_lib creating build\bdist.win32\dumb creating build\bdist.win32\dumb\Program Files creating build\bdist.win32\dumb\Program Files\Python creating build\bdist.win32\dumb\Program Files\Python\Lib creating build\bdist.win32\dumb\Program Files\Python\Lib\site-packages copying build\lib\argparse.py -> build\bdist.win32\dumb\Program Files\Python\Lib\site-packages copying build\lib\test_argparse.py -> build\bdist.win32\dumb\Program Files\Python\Lib\site-packages byte-compiling build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\argparse.py to argparse.pyc byte-compiling build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\test_argparse.py to test_argparse.pyc running install_egg_info Writing build\bdist.win32\dumb\Program Files\Python\Lib\site-packages\argparse-0.6.0-py2.5.egg-info creating 'dist\argparse-0.6.0.win32.zip' and adding '.' to it adding 'Program Files\Python\Lib\site-packages\argparse-0.6.0-py2.5.egg-info' adding 'Program Files\Python\Lib\site-packages\argparse.py' adding 'Program Files\Python\Lib\site-packages\argparse.pyc' adding 'Program Files\Python\Lib\site-packages\test_argparse.py' adding 'Program Files\Python\Lib\site-packages\test_argparse.pyc' removing 'build\bdist.win32\dumb' (and everything under it) STeVe -- http://mail.python.org/mailman/listinfo/python-list