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/specifications/install.html?a=commitdiff_plain;h=3b8dad015f1a5a31cd1331024709f850d0c70a37;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 5f6cd8c1..183718ba 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -250,10 +250,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: @@ -289,13 +289,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 38d41836..4fb39a23 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