[Python-checkins] python/nondist/sandbox/setuptools pkg_resources.py, 1.14, 1.15

pje@users.sourceforge.net pje at users.sourceforge.net
Mon May 23 04:00:44 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18564

Modified Files:
	pkg_resources.py 
Log Message:
Add a rough draft of Distribution.install_on(), to let others experiment
with 'require()' before the "official" version is complete.


Index: pkg_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/pkg_resources.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- pkg_resources.py	23 May 2005 01:56:26 -0000	1.14
+++ pkg_resources.py	23 May 2005 02:00:42 -0000	1.15
@@ -417,7 +417,6 @@
     XXX This doesn't work yet, because:
 
         * get_distro_source() isn't implemented
-        * Distribution.install_on() isn't implemented
         * AvailableDistributions.scan() is untested
 
     There may be other things missing as well, but this definitely won't work
@@ -449,6 +448,7 @@
 
 
 
+
 class DefaultProvider:
     """Provides access to package resources in the filesystem"""
 
@@ -846,6 +846,11 @@
                 raise InvalidOption("No such option", self, opt)
         return deps
 
+    def install_on(self,path=None):
+        # XXX this needs to interface with namespace packages and such
+        if path is None: path = sys.path
+        if self.path not in path:
+            path.append(self.path)
 
 
 def _sort_dists(dists):
@@ -854,11 +859,6 @@
     dists[::-1] = [d for v,d in tmp]
 
 
-
-
-
-
-
 def parse_requirements(strs):
     """Yield ``Requirement`` objects for each specification in `strs`
 



More information about the Python-checkins mailing list