Fix problem with Windows console scripts conflicting with module names,
thereby confusing the import process. Scripts are now generated with a suffix of the form '-script.py' to avoid conflicts. (The .exe's are still generated without the '-script' part, so you don't have to type it.) Thanks to Matthew R. Scott for reporting the problem. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041261
This commit is contained in:
parent
7a635d5195
commit
c23b0fb2bf
|
@ -780,6 +780,9 @@ Known Issues
|
|||
0.6a6
|
||||
* Added ``--no-deps`` option.
|
||||
|
||||
* Improved Windows ``.exe`` script wrappers so that the script can have the
|
||||
same name as a module without confusing Python.
|
||||
|
||||
0.6a3
|
||||
* Improved error message when trying to use old ways of running
|
||||
``easy_install``. Removed the ability to run via ``python -m`` or by
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
To build/rebuild with mingw32, do this in the setuptools project directory:
|
||||
|
||||
gcc -DGUI=0 -mno-cygwin -O -s -o setuptools/cli.exe launcher.c
|
||||
gcc -DGUI=1 -mwindows -mno-cygwin -O -s -o setuptools/gui.exe launcher.c
|
||||
gcc -DGUI=0 -mno-cygwin -O -s -o setuptools/cli.exe launcher.c
|
||||
gcc -DGUI=1 -mwindows -mno-cygwin -O -s -o setuptools/gui.exe launcher.c
|
||||
|
||||
It links to msvcrt.dll, but this shouldn't be a problem since it doesn't
|
||||
actually run Python in the same process. Note that using 'exec' instead
|
||||
|
@ -55,7 +55,8 @@ int run(int argc, char **argv, int is_gui) {
|
|||
end = script + strlen(script);
|
||||
while( end>script && *end != '.')
|
||||
*end-- = '\0';
|
||||
strcat(script, (GUI ? "pyw" : "py"));
|
||||
*end-- = '\0';
|
||||
strcat(script, (GUI ? "-script.pyw" : "-script.py"));
|
||||
|
||||
/* figure out the target python executable */
|
||||
|
||||
|
@ -74,7 +75,6 @@ int run(int argc, char **argv, int is_gui) {
|
|||
|
||||
*ptr = '\0';
|
||||
while (ptr>python && isspace(*ptr)) *ptr-- = '\0'; /* strip trailing sp */
|
||||
|
||||
if (strncmp(python, "#!", 2)) {
|
||||
/* default to python.exe if no #! header */
|
||||
strcpy(python, "#!python.exe");
|
||||
|
|
Binary file not shown.
|
@ -102,13 +102,13 @@ class easy_install(Command):
|
|||
|
||||
def delete_blockers(self, blockers):
|
||||
for filename in blockers:
|
||||
log.info("Deleting %s", filename)
|
||||
if not self.dry_run:
|
||||
if os.path.isdir(filename) and not os.path.islink(filename):
|
||||
shutil.rmtree(filename)
|
||||
else:
|
||||
os.unlink(filename)
|
||||
|
||||
if os.path.exists(filename) or os.path.islink(filename):
|
||||
log.info("Deleting %s", filename)
|
||||
if not self.dry_run:
|
||||
if os.path.isdir(filename) and not os.path.islink(filename):
|
||||
shutil.rmtree(filename)
|
||||
else:
|
||||
os.unlink(filename)
|
||||
|
||||
|
||||
|
||||
|
@ -464,18 +464,21 @@ class easy_install(Command):
|
|||
" load_entry_point(%(spec)r, %(group)r, %(name)r)()\n"
|
||||
")\n"
|
||||
) % locals()
|
||||
|
||||
if sys.platform=='win32':
|
||||
# On Windows, add a .py extension and an .exe launcher
|
||||
if group=='gui_scripts':
|
||||
ext, launcher = '.pyw', 'gui.exe'
|
||||
ext, launcher = '-script.pyw', 'gui.exe'
|
||||
old = ['.pyw']
|
||||
new_header = re.sub('(?i)python.exe','pythonw.exe',header)
|
||||
else:
|
||||
ext, launcher = '.py', 'cli.exe'
|
||||
ext, launcher = '-script.py', 'cli.exe'
|
||||
old = ['.py','.pyc','.pyo']
|
||||
new_header = re.sub('(?i)pythonw.exe','pythonw.exe',header)
|
||||
|
||||
if os.path.exists(new_header[2:-1]):
|
||||
header = new_header
|
||||
|
||||
self.delete_blockers( # clean up old .py/.pyw w/o a script
|
||||
[os.path.join(self.script_dir,name+x) for x in old])
|
||||
|
||||
self.write_script(name+ext, header+script_text)
|
||||
self.write_script(
|
||||
|
@ -487,9 +490,6 @@ class easy_install(Command):
|
|||
# write the stub with no extension.
|
||||
self.write_script(name, header+script_text)
|
||||
|
||||
|
||||
|
||||
|
||||
def install_script(self, dist, script_name, script_text, dev_path=None):
|
||||
"""Generate a legacy script wrapper and install it"""
|
||||
spec = str(dist.as_requirement())
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue