summaryrefslogtreecommitdiff
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-12 23:43:22 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-12 23:43:22 +0000
commitb9c686a49c0154f849aef99dcacaecffc45378eb (patch)
tree900e06a25dddd2ede3c43c8debf54bededbfd535 /setuptools/command/easy_install.py
parentf09fb93d9562fa19bb9d5c7253548a32868fd46b (diff)
downloadpython-setuptools-git-b9c686a49c0154f849aef99dcacaecffc45378eb.tar.gz
Update zip-safety scanner to check for modules that might be used as
``python -m`` scripts. Misc. fixes for win32.exe support, including changes to support Python 2.4's changed ``bdist_wininst`` format. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041123
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 1b3b72a6..36af437a 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -508,10 +508,12 @@ class easy_install(Command):
# Convert the .exe to an unpacked egg
egg_path = dist.path = os.path.join(tmpdir, dist.egg_name()+'.egg')
egg_tmp = egg_path+'.tmp'
+ pkg_inf = os.path.join(egg_tmp, 'EGG-INFO', 'PKG-INFO')
+ ensure_directory(pkg_inf) # make sure EGG-INFO dir exists
+
self.exe_to_egg(dist_filename, egg_tmp)
# Write EGG-INFO/PKG-INFO
- pkg_inf = os.path.join(egg_tmp, 'EGG-INFO', 'PKG-INFO')
f = open(pkg_inf,'w')
f.write('Metadata-Version: 1.0\n')
for k,v in cfg.items('metadata'):
@@ -529,8 +531,6 @@ class easy_install(Command):
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
@@ -575,9 +575,9 @@ class easy_install(Command):
for name in 'top_level','native_libs':
if locals()[name]:
txt = os.path.join(egg_tmp, 'EGG-INFO', name+'.txt')
- ensure_directory(txt)
open(txt,'w').write('\n'.join(locals()[name])+'\n')
+
def check_conflicts(self, dist):
"""Verify that there are no conflicting "old-style" packages"""
@@ -708,7 +708,7 @@ PYTHONPATH, or by being added to sys.path by your code.)
if self.dry_run:
args.insert(0,'-n')
- dist_dir = tempfile.mkdtemp(prefix='egg-dist-tmp-', dir=setup_base)
+ dist_dir = tempfile.mkdtemp(prefix='egg-dist-tmp-', dir=os.path.dirname(setup_script))
try:
args.append(dist_dir)
log.info(
@@ -877,13 +877,13 @@ def extract_wininst_cfg(dist_filename):
import struct, StringIO, ConfigParser
tag, cfglen, bmlen = struct.unpack("<iii",f.read(12))
- if tag<>0x1234567A:
+ if tag not in (0x1234567A, 0x1234567B):
return None # not a valid tag
f.seek(prepended-(12+cfglen+bmlen))
cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
try:
- cfg.readfp(StringIO.StringIO(f.read(cfglen)))
+ cfg.readfp(StringIO.StringIO(f.read(cfglen).split(chr(0),1)[0]))
except ConfigParser.Error:
return None
if not cfg.has_section('metadata') or not cfg.has_section('Setup'):