[Distutils] scripts versus console_scripts
ziade.tarek at gmail.com
Fri Sep 4 17:56:25 CEST 2009
On Fri, Sep 4, 2009 at 5:35 PM, Reinout van Rees<reinout at vanrees.org> wrote:
> On 2009-09-04, Reinout van Rees <reinout at vanrees.org> wrote:
>> On 2009-09-04, P.J. Eby <pje at telecommunity.com> wrote:
>>> At 01:58 PM 9/3/2009 -0400, Jim Fulton wrote:
>>>>I think the script information should be included somehow so that it
>>>>can be gotten from eggs.
>>> The original script files get stored in the "EGG-INFO/scripts" directory.
>> Ok, I got something working based on that info. Thanks! It is in the
>> zc.buildout/branches/reinout-scripts branch. Just run bin/buildout and the
>> presence of bin/pyflakes, bin/rst2s5.py and friends demonstrates that it
>> I'm not sure how robust it is, though. My main worry is that it probably only
>> works OK with unzipped eggs. "dist.location" is the egg's location:
>> scripts_dir = os.path.join(dist.location, 'EGG-INFO', 'scripts')
>> if os.path.exists(scripts_dir):
>> for name in os.listdir(scripts_dir):
>> (name, os.path.join(scripts_dir, name)))
>> So this does a basic os.path.join()... I tried pkg_resources'
>> resource_filename() call, but that doesn't work because the egg isn't
>> installed yet. But I might be overlooking something here! An alternative
>> would be to unzip an egg ourselves.
> I verified that it doesn't work with zipped eggs. Are there alternatives for
> getting my hand on that listdir of EGG-INFO/scripts/* without unzipping the
> egg? Otherwise I'm in favour of just leaving zipped eggs be.
You can browse an egg using zipimport.zimporter or try to use the
"driver" in pkg_resources
or, look at our PEP 376 prototype http://bitbucket.org/tarek/pep376.
Although, dropping zipped eggs support is a good option too imho ;)
Tarek Ziadé | http://ziade.org
More information about the Distutils-SIG