Commit c710ada1 authored by PJ Eby's avatar PJ Eby

Add a rough draft of Distribution.install_on(), to let others experiment

with 'require()' before the "official" version is complete.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041010
parent 22370657
...@@ -417,7 +417,6 @@ def require(*requirements): ...@@ -417,7 +417,6 @@ def require(*requirements):
XXX This doesn't work yet, because: XXX This doesn't work yet, because:
* get_distro_source() isn't implemented * get_distro_source() isn't implemented
* Distribution.install_on() isn't implemented
* AvailableDistributions.scan() is untested * AvailableDistributions.scan() is untested
There may be other things missing as well, but this definitely won't work There may be other things missing as well, but this definitely won't work
...@@ -447,6 +446,7 @@ def require(*requirements): ...@@ -447,6 +446,7 @@ def require(*requirements):
class DefaultProvider: class DefaultProvider:
...@@ -846,6 +846,11 @@ class Distribution(object): ...@@ -846,6 +846,11 @@ class Distribution(object):
raise InvalidOption("No such option", self, opt) raise InvalidOption("No such option", self, opt)
return deps 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): def _sort_dists(dists):
...@@ -854,11 +859,6 @@ def _sort_dists(dists): ...@@ -854,11 +859,6 @@ def _sort_dists(dists):
dists[::-1] = [d for v,d in tmp] dists[::-1] = [d for v,d in tmp]
def parse_requirements(strs): def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs` """Yield ``Requirement`` objects for each specification in `strs`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment