This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: improvement of the script adaptation for the win32 platform
Type: enhancement Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: rejected
Dependencies: Superseder: packaging: generate scripts from callable (dotted paths)
View: 12394
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, tarek, techtonik, vds2212
Priority: low Keywords: patch

Created on 2005-03-30 09:05 by vds2212, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
build_scripts.py vds2212, 2005-03-30 09:05 the modified build_scripts.py file
build_scripts.py vds2212, 2005-04-02 06:39 build_scripts.py
Messages (4)
msg48088 - (view) Author: Vivian De Smedt (vds2212) Date: 2005-03-30 09:05
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)

msg48089 - (view) Author: Vivian De Smedt (vds2212) Date: 2005-04-02 06:39
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.
msg75964 - (view) Author: anatoly techtonik (techtonik) Date: 2008-11-17 15:25
The idea with "-x" option and renaming .py to .bat is nice, but if I
want to execute the script with another version of Python or manually
without -x option I may become confused.

Would it be better to provide separated .bat files to launch scripts?
See #4015
msg153688 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-19 09:44
For distutils2, we’re going to generate .exe wrappers on Windows, like setuptools does (see #12394).

distutils is feature-frozen.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41776
2012-02-19 09:47:55eric.araujosetstatus: open -> closed
2012-02-19 09:44:05eric.araujosetassignee: tarek -> eric.araujo
superseder: packaging: generate scripts from callable (dotted paths)
components: + Distutils2, - Distutils, Windows
versions: + 3rd party, Python 3.3, - Python 3.2
nosy: + alexis, eric.araujo

messages: + msg153688
resolution: rejected
stage: resolved
2010-08-10 11:29:22floxsetassignee: tarek

components: + Windows
nosy: + tarek
2010-08-07 20:54:01terry.reedysetversions: + Python 3.2, - Python 2.6
2008-11-17 15:25:51techtoniksetnosy: + techtonik
messages: + msg75964
2008-01-05 19:17:39christian.heimessetpriority: normal -> low
type: enhancement
versions: + Python 2.6
2005-03-30 09:05:42vds2212create