Commit 89ff5b18 authored by PJ Eby's avatar PJ Eby

Catch a few missed terminology changes.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041137
parent f7288a7f
......@@ -362,7 +362,7 @@ class WorkingSet(object):
# Oops, the "best" so far conflicts with a dependency
raise VersionConflict(dist,req) # XXX put more info here
requirements.extend(dist.depends(req.extras)[::-1])
requirements.extend(dist.requires(req.extras)[::-1])
processed[req] = True
return to_activate # return list of distros to activate
......@@ -1569,8 +1569,8 @@ class Distribution(object):
_dep_map = property(_dep_map)
def depends(self,extras=()):
"""List of Requirements needed for this distro if `options` are used"""
def requires(self,extras=()):
"""List of Requirements needed for this distro if `extras` are used"""
dm = self._dep_map
deps = []
deps.extend(dm.get(None,()))
......@@ -1686,16 +1686,18 @@ def parse_requirements(strs):
raise ValueError("Missing distribution spec", line)
project_name = match.group(1)
p = match.end()
options = []
extras = []
match = OBRACKET(line,p)
if match:
p = match.end()
line, p, options = scan_list(DISTRO,CBRACKET,line,p,(1,),"option")
line, p, extras = scan_list(
DISTRO, CBRACKET, line, p, (1,), "'extra' name"
)
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
specs = [(op,val.replace('_','-')) for op,val in specs]
yield Requirement(project_name.replace('_','-'), specs, options)
yield Requirement(project_name.replace('_','-'), specs, extras)
def _sort_dists(dists):
......@@ -1718,8 +1720,6 @@ def _sort_dists(dists):
class Requirement:
def __init__(self, project_name, specs=(), extras=()):
self.project_name = project_name
......
......@@ -1419,7 +1419,7 @@ Release Notes/Change History
* Distribution objects no longer have an ``installed_on()`` method, and the
``install_on()`` method is now ``activate()`` (but may go away altogether
soon).
soon). The ``depends()`` method has also been renamed to ``requires()``.
* ``find_distributions()`` now takes an additional argument called ``only``,
that tells it to only yield distributions whose location is the passed-in
......
......@@ -105,18 +105,18 @@ class DistroTests(TestCase):
self.checkFooPkg(d)
def distDepends(self, txt):
def distRequires(self, txt):
return Distribution("/foo", metadata=Metadata(('depends.txt', txt)))
def checkDepends(self, dist, txt, opts=()):
def checkRequires(self, dist, txt, extras=()):
self.assertEqual(
list(dist.depends(opts)),
list(dist.requires(extras)),
list(parse_requirements(txt))
)
def testDistroDependsSimple(self):
for v in "Twisted>=1.5", "Twisted>=1.5\nZConfig>=2.0":
self.checkDepends(self.distDepends(v), v)
self.checkRequires(self.distRequires(v), v)
......@@ -163,29 +163,29 @@ class DistroTests(TestCase):
)
def testDistroDependsOptions(self):
d = self.distDepends("""
d = self.distRequires("""
Twisted>=1.5
[docgen]
ZConfig>=2.0
docutils>=0.3
[fastcgi]
fcgiapp>=0.1""")
self.checkDepends(d,"Twisted>=1.5")
self.checkDepends(
self.checkRequires(d,"Twisted>=1.5")
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"]
)
self.checkDepends(
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"]
)
self.checkDepends(
self.checkRequires(
d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(),
["docgen","fastcgi"]
)
self.checkDepends(
self.checkRequires(
d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(),
["fastcgi", "docgen"]
)
self.assertRaises(InvalidOption, d.depends, ["foo"])
self.assertRaises(InvalidOption, d.requires, ["foo"])
......
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