aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-10-16 20:45:30 +0000
committerPJ Eby <distutils-sig@python.org>2005-10-16 20:45:30 +0000
commitc23b0fb2bfbd8df35ebee9551458ed00e0f2095c (patch)
tree7b535fe7eab66d13a987f9125d5e177c634ab40b /setuptools/command/easy_install.py
parent7a635d5195358704e12cc92d83a0b7b802e662da (diff)
downloadexternal_python_setuptools-c23b0fb2bfbd8df35ebee9551458ed00e0f2095c.tar.gz
external_python_setuptools-c23b0fb2bfbd8df35ebee9551458ed00e0f2095c.tar.bz2
external_python_setuptools-c23b0fb2bfbd8df35ebee9551458ed00e0f2095c.zip
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
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index b32be711..d85858a7 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -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())