Philip, I was trying to install yolk with c:\python25\python -m easy_install yolk (on Windows, as you can see). A yolk.py script is installed in c:\Python25\Scripts, but between each source line there is an empty line. In other words, line feeds are doubled each time. This leads to syntax errors because continuation lines don't work any longer. It seems easy_install gets the newlines wrong. Thanks, Thomas PS: This is not the first time I had strange problems with Scripts in distributions installed by easy_install, but it is the first time I'm reporting it.
At 07:37 PM 2/1/2007 +0100, Thomas Heller wrote:
Philip,
I was trying to install yolk with
c:\python25\python -m easy_install yolk
(on Windows, as you can see).
A yolk.py script is installed in c:\Python25\Scripts, but between each source line there is an empty line. In other words, line feeds are doubled each time. This leads to syntax errors because continuation lines don't work any longer.
It seems easy_install gets the newlines wrong.
Yep, the problem was exclusive to "old-style" scripts, which yolk is using for some reason. (It could just move yolk's main() function to yolklib and list in the the setup script's entry points.) It's fixed it now in SVN.
Phillip J. Eby schrieb:
At 07:37 PM 2/1/2007 +0100, Thomas Heller wrote:
Philip,
I was trying to install yolk with
c:\python25\python -m easy_install yolk
(on Windows, as you can see).
A yolk.py script is installed in c:\Python25\Scripts, but between each source line there is an empty line. In other words, line feeds are doubled each time. This leads to syntax errors because continuation lines don't work any longer.
It seems easy_install gets the newlines wrong.
Yep, the problem was exclusive to "old-style" scripts, which yolk is using for some reason. (It could just move yolk's main() function to yolklib and list in the the setup script's entry points.)
It's fixed it now in SVN.
and it works for me, now. Boy, are you quick! For my education: what are "old-style" scripts? Thanks, Thomas
At 08:22 PM 2/1/2007 +0100, Thomas Heller wrote:
Phillip J. Eby schrieb:
At 07:37 PM 2/1/2007 +0100, Thomas Heller wrote:
Philip,
I was trying to install yolk with
c:\python25\python -m easy_install yolk
(on Windows, as you can see).
A yolk.py script is installed in c:\Python25\Scripts, but between each source line there is an empty line. In other words, line feeds are doubled each time. This leads to syntax errors because continuation lines don't work any longer.
It seems easy_install gets the newlines wrong.
Yep, the problem was exclusive to "old-style" scripts, which yolk is using for some reason. (It could just move yolk's main() function to yolklib and list in the the setup script's entry points.)
It's fixed it now in SVN.
and it works for me, now. Boy, are you quick!
And just as quick to create new bugs... see below. :(
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. (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.)
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
participants (2)
-
Phillip J. Eby
-
Thomas Heller