[Distutils] How to use buildout with a scripts directory?

Jon Wright wright at esrf.fr
Wed Feb 11 09:33:48 CET 2009


Dear distutils-sig,

[Apologies if this is a newbie question]

I am trying to use buildout and am having trouble to figure out how to
get it to install the scripts that come with a package. They are
present inside the egg which is installed by buildout, but they don't
end up in the bin directory. After running buildout my bin directory
is empty, but I can find:

.\eggs\imaged11-1.2.3-py2.5-win32.egg\EGG-INFO\scripts\peaksearch.py

In the package I have a directory (ImageD11) with the library stuff in
it and a directory named "scripts" with the scripts. When I use
distutils or setuptools it does what I expected:

setup.py:
...
setup(name='ImageD11',
       ...,
       packages = ["ImageD11"],
       package_dir = {"ImageD11":"ImageD11"},
      scripts = [ "scripts/peaksearch.py",
                     "scripts/bgmaker.py",
                     ...]
      )

c:\testImageD11distutils\> python setup.py install
...
Installing peaksearch.py script to c:\python25\Scripts
Installing bgmaker.py script to c:\python25\Scripts

Now I am wondering how to persuade "buildout" to do the same thing,
but place those scripts into it's own little area.

In buildout.cfg I have:
==================
[buildout]
parts = ImageD11

[ImageD11]
recipe = zc.recipe.egg:scripts
scripts = scripts/peaksearch.py
eggs = ImageD11
version = 1.2.3

It seems to acknowledge that scripts/peaksearch.py is requested, but
doesn't seem to do anything about it. My scripts mostly just map
command line arguments to function calls, something like this:

if __name__=="__main__":
     import ImageD11.something, sys
     ImageD11.something.do_thing( sys.argv[1], sys.argv[2] )

I've read the documentation at http://pypi.python.org/pypi/zc.buildout
several times but I still can't figure out how to make these scripts
part of the build. There seems to be a lot of talk about entry_points,
but I'm blocked on those:
  * what is the entry point for an if __name__=="__main__": idiom?
  * as these things were in ./scripts/, they aren't in the module, so 
how to I reference them anyway?

Thanks in advance for any help!

Jon



More information about the Distutils-SIG mailing list