aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/egg_info.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-24 22:47:06 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-24 22:47:06 +0000
commit1c40632b88d76aea178e751483645ec3d32c81d9 (patch)
tree2cc3fa1af58200d5199b30771053c527ef91bd93 /setuptools/command/egg_info.py
parent8618cfa8ac93431ffcede4f3987b559449bbbcb8 (diff)
downloadexternal_python_setuptools-1c40632b88d76aea178e751483645ec3d32c81d9.tar.gz
external_python_setuptools-1c40632b88d76aea178e751483645ec3d32c81d9.tar.bz2
external_python_setuptools-1c40632b88d76aea178e751483645ec3d32c81d9.zip
Implement "entry points" for dynamic discovery of drivers and plugins.
Change setuptools to discover setup commands using an entry point group called "distutils.commands". Thanks to Ian Bicking for the suggestion that led to designing this super-cool feature. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041152
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-xsetuptools/command/egg_info.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index a5418568..8577230f 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -8,7 +8,7 @@ from setuptools import Command
from distutils.errors import *
from distutils import log
from pkg_resources import parse_requirements, safe_name, \
- safe_version, yield_lines
+ safe_version, yield_lines, EntryPoint
from setuptools.dist import iter_distribution_names
class egg_info(Command):
@@ -95,7 +95,7 @@ class egg_info(Command):
metadata.write_pkg_info(self.egg_info)
finally:
metadata.name, metadata.version = oldname, oldver
-
+ self.write_entry_points()
self.write_requirements()
self.write_toplevel_names()
self.write_or_delete_dist_arg('namespace_packages')
@@ -183,23 +183,23 @@ class egg_info(Command):
if not self.dry_run:
os.unlink(filename)
+ def write_entry_points(self):
+ ep = getattr(self.distribution,'entry_points',None)
+ if ep is None:
+ return
+ epname = os.path.join(self.egg_info,"entry_points.txt")
+ log.info("writing %s", epname)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ if not self.dry_run:
+ f = open(epname, 'wt')
+ if isinstance(ep,basestring):
+ f.write(ep)
+ else:
+ for section, contents in ep.items():
+ if not isinstance(contents,basestring):
+ contents = EntryPoint.parse_list(section, contents)
+ contents = '\n'.join(map(str,contents.values()))
+ f.write('[%s]\n%s\n\n' % (section,contents))
+ f.close()