[Distutils] setuptools problem?

Thomas Heller theller at ctypes.org
Thu Feb 1 21:47:39 CET 2007


Phillip J. Eby schrieb:
>>For my education: what are "old-style" scripts?
> 
> A script specified in the 'scripts' option to setup(), as opposed to via 
> entry_points.
> 
> Now, what I just realized when I typed that answer above, is that normally 
> Python scripts specified in setup() would be installed using a wrapper that 
> handles require()-ing the package's dependencies.
> 
> So, the real problem turned out to be that the 'yolk.py' script was not 
> being detected as being a *Python* script, if the build_scripts command was 
> run on Windows.  This would put a #! line in place with 'python.exe' 
> instead of 'python', which distutils' "first_line_re" pattern would not 
> match at install time.
> 
> So, when I fixed the broken line endings, I missed the fact that the broken 
> code should never have been running at all.  In effect, only non-Python 
> scripts should've had their contents messed up!  (Well, they shouldn't be 
> messed up, but the point is that there were *two* bugs here, and I missed 
> one of them.)
> 
> So, now I've fixed the script language detection to be more lenient 
> regarding #! lines, and in fact it will only bother with the #! line if the 
> script filename is not .py/.pyw and the content isn't syntactically valid 
> Python.

This explains at least one of the other problems that I didn't remember first.
IIRC, easy_install also added a #!whatever line to batch files ;-), but
it I have then removed these packages (or installed them in the traditional way).

> (By the way, you might want to mention to the yolk author that his/her 
> package depends on ElementTree, but it's not listed in the project's 
> install_requires.  So, when I tried running the 'yolk' script it failed 
> because I didn't have ElementTree installed.)

Yes, I found that also, and even noticed another problem (I post this here
so that I can point the guy to this post):

c:\>py25 \python25\scripts\yolk.py -l
argparse (0.5.0)
Traceback (most recent call last):
  File "\python25\scripts\yolk.py", line 462, in <module>
    sys.exit(main())
  File "\python25\scripts\yolk.py", line 426, in main
    options.fields)
  File "\python25\scripts\yolk.py", line 49, in show_distributions
    print_metadata(show, metadata, active, show_metadata, fields)
  File "\python25\scripts\yolk.py", line 87, in print_metadata
    print "    %s" % metadata['Summary']
KeyError: 'Summary'
> c:\python25\scripts\yolk.py(87)print_metadata()
-> print "    %s" % metadata['Summary']
(Pdb)


Thanks,
Thomas



More information about the Distutils-SIG mailing list