[Python-checkins] r46722 - in sandbox/branches/setuptools-0.6: setuptools.txt setuptools/command/bdist_egg.py
phillip.eby
python-checkins at python.org
Wed Jun 7 21:36:50 CEST 2006
Author: phillip.eby
Date: Wed Jun 7 21:36:49 2006
New Revision: 46722
Modified:
sandbox/branches/setuptools-0.6/setuptools.txt
sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py
Log:
Fix bdist_egg not including files in .egg-info subdirectories.
(merge from trunk)
Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt (original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt Wed Jun 7 21:36:49 2006
@@ -2498,6 +2498,9 @@
Release Notes/Change History
----------------------------
+0.6b3
+ * Fix bdist_egg not including files in .egg-info subdirectories.
+
0.6b1
* Strip ``module`` from the end of compiled extension modules when computing
the name of a ``.py`` loader/wrapper. (Python's import machinery ignores
Modified: sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py Wed Jun 7 21:36:49 2006
@@ -8,7 +8,7 @@
from distutils.dir_util import remove_tree, mkpath
from distutils.sysconfig import get_python_version, get_python_lib
from distutils import log
-from pkg_resources import get_build_platform, Distribution
+from pkg_resources import get_build_platform, Distribution, ensure_directory
from types import CodeType
from setuptools.extension import Library
@@ -91,7 +91,7 @@
def finalize_options(self):
- ei_cmd = self.get_finalized_command("egg_info")
+ ei_cmd = self.ei_cmd = self.get_finalized_command("egg_info")
self.egg_info = ei_cmd.egg_info
if self.bdist_dir is None:
@@ -216,10 +216,7 @@
if not self.dry_run:
os.unlink(native_libs)
- for filename in os.listdir(self.egg_info):
- path = os.path.join(self.egg_info,filename)
- if os.path.isfile(path):
- self.copy_file(path,os.path.join(egg_info,filename))
+ self.copy_metadata_to(egg_info)
write_safety_flag(
os.path.join(archive_root,'EGG-INFO'), self.zip_safe()
@@ -233,7 +230,7 @@
if self.exclude_source_files:
self.zap_pyfiles()
-
+
# Make the archive
make_zipfile(self.egg_output, archive_root, verbose=self.verbose,
dry_run=self.dry_run)
@@ -244,6 +241,9 @@
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):
@@ -262,7 +262,7 @@
def make_init_files(self):
"""Create missing package __init__ files"""
- init_files = []
+ init_files = []
for base,dirs,files in walk_egg(self.bdist_dir):
if base==self.bdist_dir:
# don't put an __init__ in the root
@@ -276,7 +276,7 @@
filename = os.path.join(base,'__init__.py')
if not self.dry_run:
f = open(filename,'w'); f.write(NS_PKG_STUB)
- f.close()
+ f.close()
init_files.append(filename)
break
else:
@@ -285,6 +285,14 @@
return init_files
+ def copy_metadata_to(self, target_dir):
+ prefix = os.path.join(self.egg_info,'')
+ for path in self.ei_cmd.filelist.files:
+ if path.startswith(prefix):
+ target = os.path.join(target_dir, path[len(prefix):])
+ ensure_directory(target)
+ self.copy_file(path, target)
+
def get_ext_outputs(self):
"""Get a list of relative paths to C extensions in the output distro"""
@@ -318,18 +326,10 @@
-
-
-
-
-
-
-
-
def walk_egg(egg_dir):
"""Walk an unpacked egg's contents, skipping the metadata directory"""
walker = os.walk(egg_dir)
- base,dirs,files = walker.next()
+ base,dirs,files = walker.next()
if 'EGG-INFO' in dirs:
dirs.remove('EGG-INFO')
yield base,dirs,files
@@ -448,4 +448,4 @@
return zip_filename
-
+#
More information about the Python-checkins
mailing list