diff options
author | PJ Eby <distutils-sig@python.org> | 2005-12-14 20:49:36 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-12-14 20:49:36 +0000 |
commit | 207ddcbad2db42f7f94099ab501ab46351e56f4d (patch) | |
tree | 05f90aa9c61a5414411adcca818bfdf15d57d2be /setuptools/command/bdist_egg.py | |
parent | 13e9b3d6cbdc9c7a8bda76a7d7029e790c02507b (diff) | |
download | external_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/bdist_egg.py')
-rw-r--r-- | setuptools/command/bdist_egg.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 9003542f..16d2486f 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -221,7 +221,9 @@ class bdist_egg(Command): if os.path.isfile(path): self.copy_file(path,os.path.join(egg_info,filename)) - write_safety_flag(archive_root, self.zip_safe()) + write_safety_flag( + os.path.join(archive_root,'EGG-INFO'), self.zip_safe() + ) if os.path.exists(os.path.join(self.egg_info,'depends.txt')): log.warn( @@ -242,8 +244,6 @@ class bdist_egg(Command): getattr(self.distribution,'dist_files',[]).append( ('bdist_egg',get_python_version(),self.egg_output)) - - def zap_pyfiles(self): log.info("Removing .py files from temporary directory") for base,dirs,files in walk_egg(self.bdist_dir): @@ -337,6 +337,11 @@ def walk_egg(egg_dir): yield bdf def analyze_egg(egg_dir, stubs): + # check for existing flag in EGG-INFO + for flag,fn in safety_flags.items(): + if os.path.exists(os.path.join(egg_dir,'EGG-INFO',fn)): + return flag + safe = True for base, dirs, files in walk_egg(egg_dir): for name in files: @@ -345,27 +350,22 @@ def analyze_egg(egg_dir, stubs): elif name.endswith('.pyc') or name.endswith('.pyo'): # always scan, even if we already know we're not safe safe = scan_module(egg_dir, base, name, stubs) and safe - '''elif safe: - log.warn( - "Distribution contains data or extensions; assuming " - "it's unsafe (set zip_safe=True in setup() to change" - ) - safe = False # XXX''' return safe def write_safety_flag(egg_dir, safe): - # Write a zip safety flag file - flag = safe and 'zip-safe' or 'not-zip-safe' - open(os.path.join(egg_dir,'EGG-INFO',flag),'w').close() - - - - - - - - - + # Write or remove zip safety flag file(s) + for flag,fn in safety_flags.items(): + fn = os.path.join(egg_dir, fn) + if os.path.exists(fn): + if safe is None or bool(safe)<>flag: + os.unlink(fn) + elif safe is not None and bool(safe)==flag: + open(fn,'w').close() + +safety_flags = { + True: 'zip-safe', + False: 'not-zip-safe', +} def scan_module(egg_dir, base, name, stubs): """Check whether module possibly uses unsafe-for-zipfile stuff""" |