[Distutils] How to use buildout with a scripts directory?
Jon Wright
wright at esrf.fr
Thu Feb 12 10:13:11 CET 2009
Thanks for your clarifying this for me - I will convert the scripts to
use entry points instead.
Jon
Jim Fulton wrote:
> buildout only supports scripts defined as entry points. I'm skeptical
> that it can support non-entry-point scripts, as it wouldn't, without
> some serious hackery, be able to control the paths used by the scripts.
>
> Jim
>
> On Feb 11, 2009, at 3:33 AM, Jon Wright wrote:
>
>> 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
>>
>> _______________________________________________
>> Distutils-SIG maillist - Distutils-SIG at python.org
>> http://mail.python.org/mailman/listinfo/distutils-sig
>
> --
> Jim Fulton
> Zope Corporation
>
>
More information about the Distutils-SIG
mailing list