From: Daira Hopwood Date: Fri, 10 Jul 2015 05:27:56 +0000 (+0100) Subject: __init__.py: support == requirements. X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/frontends/running.html?a=commitdiff_plain;h=6f14057f4e4a126d4d8ab6148e120e5c31e01ab2;p=tahoe-lafs%2Ftahoe-lafs.git __init__.py: support == requirements. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index 0b0c5f81..9f08f768 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -269,10 +269,10 @@ def get_package_versions_and_locations(): def check_requirement(req, vers_and_locs): - # We support only conjunctions of <=, >=, and != + # We support only conjunctions of <=, >=, ==, and != reqlist = req.split(',') - name = reqlist[0].split('<=')[0].split('>=')[0].split('!=')[0].strip(' ').split('[')[0] + name = reqlist[0].split('<=')[0].split('>=')[0].split('==')[0].split('!=')[0].strip(' ').split('[')[0] if name not in vers_and_locs: raise PackagingError("no version info for %s" % (name,)) if req.strip(' ') == name: @@ -308,13 +308,19 @@ def match_requirement(req, reqlist, actualver): if not (actualver >= normalized_version(required, what="required minimum version %r in %r" % (required, req))): return False # minimum requirement not met else: - s = r.split('!=') + s = r.split('==') if len(s) == 2: required = s[1].strip(' ') - if not (actualver != normalized_version(required, what="excluded version %r in %r" % (required, req))): - return False # not-equal requirement not met + if not (actualver == normalized_version(required, what="required exact version %r in %r" % (required, req))): + return False # exact requirement not met else: - raise PackagingError("no version info or could not understand requirement %r" % (req,)) + s = r.split('!=') + if len(s) == 2: + required = s[1].strip(' ') + if not (actualver != normalized_version(required, what="excluded version %r in %r" % (required, req))): + return False # not-equal requirement not met + else: + raise PackagingError("no version info or could not understand requirement %r" % (req,)) return True diff --git a/src/allmydata/_auto_deps.py b/src/allmydata/_auto_deps.py index 615e82a0..c2d01c5e 100644 --- a/src/allmydata/_auto_deps.py +++ b/src/allmydata/_auto_deps.py @@ -13,7 +13,7 @@ # * >= X, != Y, != Z, ... where X < Y < Z... # # (In addition, check_requirement in allmydata/__init__.py only supports -# >=, <= and != operators.) +# >=, <=, ==, and != operators.) install_requires = [ # We require newer versions of setuptools (actually