[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.6, 1.7 egg_info.py, 1.5, 1.6

pje@users.sourceforge.net pje at users.sourceforge.net
Sun Jul 10 17:43:13 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13460/setuptools/command
Modified Files:
	easy_install.py egg_info.py 
Log Message:
Implement ``namespace_packages`` keyword to ``setup()``. Added keyword
summary to setuptools doc. Begin work on ``zip_safe`` flag.
Index: easy_install.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- easy_install.py	10 Jul 2005 05:29:44 -0000	1.6
+++ easy_install.py	10 Jul 2005 15:43:08 -0000	1.7
@@ -21,7 +21,7 @@
 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 @@
 
 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 @@
 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
Index: egg_info.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/egg_info.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- egg_info.py	10 Jul 2005 04:49:31 -0000	1.5
+++ egg_info.py	10 Jul 2005 15:43:08 -0000	1.6
@@ -9,7 +9,7 @@
 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 @@
 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 @@
 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 @@
 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 @@
 
 
 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 @@
 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)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /