Commit f5166857 authored by PJ Eby's avatar PJ Eby

Fix bdist_egg not including files in .egg-info subdirectories.

(merge from trunk)

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4046722
parent 760c89ad
......@@ -2498,6 +2498,9 @@ XXX
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
......
......@@ -8,7 +8,7 @@ from setuptools import Command
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 @@ class bdist_egg(Command):
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 @@ class bdist_egg(Command):
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()
......@@ -244,6 +241,9 @@ 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):
......@@ -285,6 +285,14 @@ class bdist_egg(Command):
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,14 +326,6 @@ NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split())
def walk_egg(egg_dir):
"""Walk an unpacked egg's contents, skipping the metadata directory"""
walker = os.walk(egg_dir)
......@@ -448,4 +448,4 @@ def make_zipfile (zip_filename, base_dir, verbose=0, dry_run=0, compress=None):
return zip_filename
#
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment