[Distutils] small improvement of the script functionality under
Vivian De Smedt
vivian at vdesmedt.com
Sat Apr 2 08:37:33 CEST 2005
Here is a small summary of the remark made arround the she-bang
modification of the windows platform.
1. Trent let us know that the she-bang modification works only for the
win nt sons and that in general it is better to use the .bat extension
instead of the .cmd one
2. I realize that we shouldn't change the extension of a script if it
exist since the extention could be usefull to determine which version of
python to run
- pythonw for the .pyw extention
- python for the .py extention
According to these remarks and in the purpose to be as conservative as
possible I make this another proposition:
The change in the she bang will happend only if
- the win32 platform is detected (os.name == "nt")
- the platform is win NT son (os.environ["OS"] == "Windows_NT")
- the original script had no extension (os.path.splitext(outfile) == "")
Furthermore I add the %* in the new nt she-bang to let the underlying
script know about command line argument.
such that the unix she-bang:
#!python foo bar
@C:\Python24\Python.exe -x "%%~f0" foo bar %* & exit /b
I think that in these conditions the change could only improve the
existing situation at least it improve for some them (Zope, Chetaah,
Tell me what you think about the proposed change.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Distutils-SIG