[Distutils] scripts versus console_scripts

Jim Fulton jim at zope.com
Fri Sep 4 18:55:32 CEST 2009

On Fri, Sep 4, 2009 at 11:35 AM, 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
>> works.
>> 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):
>>             distutils_scripts.append(
>>                 (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.

Sure, use the zipfile module.


Jim Fulton

More information about the Distutils-SIG mailing list