[Patches] [ python-Patches-1173134 ] improvement of the script
adaptation for the win32 platform
SourceForge.net
noreply at sourceforge.net
Sat Apr 2 08:39:41 CEST 2005
Patches item #1173134, was opened at 2005-03-30 11:05
Message generated for change (Comment added) made by vds2212
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1173134&group_id=5470
Category: Distutils and setup.py
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Vivian De Smedt (vds2212)
Assigned to: Nobody/Anonymous (nobody)
Summary: improvement of the script adaptation for the win32 platform
Initial Comment:
Distutils have a script functionality that copy the
corresponding file
into a common script folder (that could be on the
path) and sligthly
modify the first line of the script to reflect the path
of the python
executable.
It is very nice because it make new commands
directly available but
for the window platform I think it could be
improved.
First the extention of the script could be .bat such
that they will be
accessible as commands as soon as the script
folder is in the path.
Second the first line adaptation could be slightly
different and take
advantage of the -x option of the python executable
#!python foo bar
could become:
@C:\Python24\python.exe -x "%~f0" foo bar & exit /
b
instead of:
#!C:\Python24\python.exe -x "%~f0" foo bar & exit /
b
In attachement I add my modified version of the
build_scripts.py file (Revision 1.25, the head of the
30th of March)
----------------------------------------------------------------------
>Comment By: Vivian De Smedt (vds2212)
Date: 2005-04-02 08:39
Message:
Logged In: YES
user_id=511447
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)[1] == "")
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
will become:
@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, PyCrust, IPython)
Tell me what you think about the proposed change.
Vivian.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1173134&group_id=5470
More information about the Patches
mailing list