[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.66, 1.67
pje@users.sourceforge.net
pje at users.sourceforge.net
Sun Aug 14 08:03:32 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11496
Modified Files:
pkg_resources.py
Log Message:
Make "run_script" a method of WorkingSet objects, thereby removing a global
coupling.
Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- pkg_resources.py 14 Aug 2005 01:45:37 -0000 1.66
+++ pkg_resources.py 14 Aug 2005 06:03:20 -0000 1.67
@@ -398,13 +398,13 @@
elif name in entries:
yield entries[name]
-
-
-
-
-
-
-
+ def run_script(self, requires, script_name):
+ """Locate distribution for `requires` and run `script_name` script"""
+ ns = sys._getframe(1).f_globals
+ name = ns['__name__']
+ ns.clear()
+ ns['__name__'] = name
+ self.require(requires)[0].run_script(script_name, ns)
@@ -2147,6 +2147,8 @@
require = working_set.require
iter_entry_points = working_set.iter_entry_points
add_activation_listener = working_set.subscribe
+run_script = working_set.run_script
+run_main = run_script # backward compatibility
# Activate all distributions already on sys.path, and ensure that
# all distributions added to the working set in the future (e.g. by
@@ -2169,5 +2171,3 @@
-
-
More information about the Python-checkins
mailing list