aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/egg_info.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-10 15:43:08 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-10 15:43:08 +0000
commit39fc2a15c4a236ae7b378ebb98aee545776d2ec1 (patch)
treec8806db2eb70d3620795df65425a0ca53d1f648d /setuptools/command/egg_info.py
parent7922a815d08c4a5ac975e785aad90c3f4c6eaabb (diff)
downloadexternal_python_setuptools-39fc2a15c4a236ae7b378ebb98aee545776d2ec1.tar.gz
external_python_setuptools-39fc2a15c4a236ae7b378ebb98aee545776d2ec1.tar.bz2
external_python_setuptools-39fc2a15c4a236ae7b378ebb98aee545776d2ec1.zip
Implement ``namespace_packages`` keyword to ``setup()``. Added keyword
summary to setuptools doc. Begin work on ``zip_safe`` flag. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041113
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-xsetuptools/command/egg_info.py69
1 files changed, 55 insertions, 14 deletions
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)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+