[Distutils] scripts versus console_scripts

Reinout van Rees reinout at vanrees.org
Fri Sep 4 14:05:40 CEST 2009


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.


There are enough "if" statements to make it safe, I guess.  It will have to be
tested on windows, for sure (which I cannot).  And: it *does* solve the 90%
usecase of just installing pyflakes and docutils' scripts!


Reinout


-- 
Reinout van Rees - reinout at vanrees.org - http://reinout.vanrees.org
Software developer at http://www.thehealthagency.com
"Military engineers build missiles. Civil engineers build targets"



More information about the Distutils-SIG mailing list