[Distutils] scripts versus console_scripts
P.J. Eby
pje at telecommunity.com
Fri Sep 4 23:59:43 CEST 2009
At 12:05 PM 9/4/2009 +0000, Reinout van Rees 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)))
Ugh. Seriously not kosher. Use this instead:
if dist.metadata_isdir('scripts'):
for name in dist.metadata_listdir('scripts'):
script_text = dist.get_metadata('scripts/'+name)
# write the text to a file and do whatever else you want
More information about the Distutils-SIG
mailing list