diff options
Diffstat (limited to 'setuptools/command')
| -rwxr-xr-x | setuptools/command/easy_install.py | 4 | ||||
| -rwxr-xr-x | setuptools/command/egg_info.py | 69 |
2 files changed, 57 insertions, 16 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e089cedb..b80dcb8d 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -21,7 +21,7 @@ from distutils.errors import DistutilsArgError, DistutilsOptionError, DistutilsE from setuptools.archive_util import unpack_archive from setuptools.package_index import PackageIndex, parse_bdist_wininst from setuptools.package_index import URL_SCHEME -from setuptools.command import bdist_egg +from setuptools.command import bdist_egg, egg_info from pkg_resources import * __all__ = [ @@ -697,6 +697,7 @@ PYTHONPATH, or by being added to sys.path by your code.) def build_and_install(self, setup_script, setup_base, zip_ok): sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) + sys.modules.setdefault('distutils.command.bdist_egg', egg_info) args = ['bdist_egg', '--dist-dir'] if self.verbose>2: @@ -735,7 +736,6 @@ PYTHONPATH, or by being added to sys.path by your code.) shutil.rmtree(dist_dir) log.set_verbosity(self.verbose) # restore our log verbosity - def update_pth(self,dist): if self.pth_file is None: return diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index dca4e2a3..68e2fefb 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -9,7 +9,7 @@ from distutils.errors import * from distutils import log from pkg_resources import parse_requirements, safe_name, \ safe_version, yield_lines - +from setuptools.dist import iter_distribution_names class egg_info(Command): @@ -83,8 +83,8 @@ class egg_info(Command): def run(self): # Make the .egg-info directory, then write PKG-INFO and requires.txt self.mkpath(self.egg_info) + log.info("writing %s" % os.path.join(self.egg_info,'PKG-INFO')) - log.info("writing %s" % os.path.join(self.egg_info,'PKG-INFO')) if not self.dry_run: metadata = self.distribution.metadata metadata.version, oldver = self.egg_version, metadata.version @@ -96,15 +96,16 @@ class egg_info(Command): finally: metadata.name, metadata.version = oldname, oldver + self.write_namespace_packages() self.write_requirements() self.write_toplevel_names() + if os.path.exists(os.path.join(self.egg_info,'depends.txt')): log.warn( "WARNING: 'depends.txt' will not be used by setuptools 0.6!\n" "Use the install_requires/extras_require setup() args instead." ) - def write_requirements(self): dist = self.distribution if not getattr(dist,'install_requires',None) and \ @@ -120,7 +121,6 @@ class egg_info(Command): f.write('\n\n[%s]\n%s' % (extra, '\n'.join(yield_lines(reqs)))) f.close() - def tagged_version(self): version = self.distribution.get_version() if self.tag_build: @@ -144,16 +144,12 @@ class egg_info(Command): def write_toplevel_names(self): - pkgs = dict.fromkeys(self.distribution.packages or ()) - pkgs.update(dict.fromkeys(self.distribution.py_modules or ())) - for ext in self.distribution.ext_modules or (): - if isinstance(ext,tuple): - name,buildinfo = ext - else: - name = ext.name - pkgs[name]=1 - pkgs = dict.fromkeys([k.split('.',1)[0] for k in pkgs]) - toplevel = os.path.join(self.egg_info,"top_level.txt") + pkgs = dict.fromkeys( + [k.split('.',1)[0] + for k in iter_distribution_names(self.distribution) + ] + ) + toplevel = os.path.join(self.egg_info, "top_level.txt") log.info("writing list of top-level names to %s" % toplevel) if not self.dry_run: f = open(toplevel, 'wt') @@ -162,3 +158,48 @@ class egg_info(Command): f.close() + + + + + def write_namespace_packages(self): + nsp = getattr(self.distribution,'namespace_packages',None) + if nsp is None: + return + + filename = os.path.join(self.egg_info,"namespace_packages.txt") + + if nsp: + log.info("writing %s", filename) + if not self.dry_run: + f = open(filename, 'wt') + f.write('\n'.join(nsp)) + f.write('\n') + f.close() + + elif os.path.exists(filename): + log.info("deleting %s", filename) + if not self.dry_run: + os.unlink(filename) + + + + + + + + + + + + + + + + + + + + + + |
