aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-12-14 20:49:36 +0000
committerPJ Eby <distutils-sig@python.org>2005-12-14 20:49:36 +0000
commit207ddcbad2db42f7f94099ab501ab46351e56f4d (patch)
tree05f90aa9c61a5414411adcca818bfdf15d57d2be /setuptools/command/easy_install.py
parent13e9b3d6cbdc9c7a8bda76a7d7029e790c02507b (diff)
downloadexternal_python_setuptools-207ddcbad2db42f7f94099ab501ab46351e56f4d.tar.gz
external_python_setuptools-207ddcbad2db42f7f94099ab501ab46351e56f4d.tar.bz2
external_python_setuptools-207ddcbad2db42f7f94099ab501ab46351e56f4d.zip
Basic roundtripping support between bdist_wininst and eggs. EasyInstall
will now recognize when a bdist_wininst .exe wraps a .egg-info style package, and reconstitute it correctly, maintaining the original zip safety flag, if applicable. This still needs support for entrypoint scripts, though, as does the install_scripts command. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041678
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 20bdbe89..c09e597b 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -145,7 +145,7 @@ class easy_install(Command):
site_dirs = [
os.path.expanduser(s.strip()) for s in self.site_dirs.split(',')
]
- for d in site_dirs:
+ for d in site_dirs:
if not os.path.isdir(d):
log.warn("%s (in --site-dirs) does not exist", d)
elif normalize_path(d) not in normpath:
@@ -637,12 +637,13 @@ class easy_install(Command):
self.exe_to_egg(dist_filename, egg_tmp)
# Write EGG-INFO/PKG-INFO
- f = open(pkg_inf,'w')
- f.write('Metadata-Version: 1.0\n')
- for k,v in cfg.items('metadata'):
- if k<>'target_version':
- f.write('%s: %s\n' % (k.replace('_','-').title(), v))
- f.close()
+ if not os.path.exists(pkg_inf):
+ f = open(pkg_inf,'w')
+ f.write('Metadata-Version: 1.0\n')
+ for k,v in cfg.items('metadata'):
+ if k<>'target_version':
+ f.write('%s: %s\n' % (k.replace('_','-').title(), v))
+ f.close()
# Build .egg file from tmpdir
bdist_egg.make_zipfile(
@@ -653,7 +654,6 @@ class easy_install(Command):
# install the .egg
return self.install_egg(egg_path, tmpdir)
-
def exe_to_egg(self, dist_filename, egg_tmp):
"""Extract a bdist_wininst to the directories an egg would use"""
# Check for .pth file and set up prefix translations
@@ -692,14 +692,14 @@ class easy_install(Command):
bdist_egg.write_stub(resource, pyfile)
self.byte_compile(to_compile) # compile .py's
- bdist_egg.write_safety_flag(egg_tmp,
+ bdist_egg.write_safety_flag(os.path.join(egg_tmp,'EGG-INFO'),
bdist_egg.analyze_egg(egg_tmp, stubs)) # write zip-safety flag
for name in 'top_level','native_libs':
if locals()[name]:
txt = os.path.join(egg_tmp, 'EGG-INFO', name+'.txt')
- open(txt,'w').write('\n'.join(locals()[name])+'\n')
-
+ if not os.path.exists(txt):
+ open(txt,'w').write('\n'.join(locals()[name])+'\n')
def check_conflicts(self, dist):
"""Verify that there are no conflicting "old-style" packages"""
@@ -1076,10 +1076,12 @@ def get_exe_prefixes(exe_filename):
try:
for info in z.infolist():
name = info.filename
- if not name.endswith('.pth'):
- continue
parts = name.split('/')
- if len(parts)<>2:
+ if len(parts)==3 and parts[2]=='PKG-INFO':
+ if parts[1].endswith('.egg-info'):
+ prefixes.insert(0,('/'.join(parts[:2]), 'EGG-INFO/'))
+ break
+ if len(parts)<>2 or not name.endswith('.pth'):
continue
if parts[0] in ('PURELIB','PLATLIB'):
pth = z.read(name).strip()
@@ -1103,8 +1105,6 @@ def parse_requirement_arg(spec):
-
-
class PthDistributions(Environment):
"""A .pth file with Distribution paths in it"""