summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-11-06 15:55:19 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-11-06 15:55:19 +0000
commitdae64ae15175409d91eee251b4c551f5014b191e (patch)
treeb7fea5d3b878ffe551077b488c95ec604091c7ee
parentf35729c8c4e66dc0b91af110e911533040c63c66 (diff)
downloadimport-dae64ae15175409d91eee251b4c551f5014b191e.tar.gz
Use pkg_resources.parse_version to handle more version types
-rwxr-xr-xexts/pip.find_deps26
1 files changed, 16 insertions, 10 deletions
diff --git a/exts/pip.find_deps b/exts/pip.find_deps
index 15465ed..3a50f1b 100755
--- a/exts/pip.find_deps
+++ b/exts/pip.find_deps
@@ -94,9 +94,9 @@ class Dependency(object):
def get_bounds_conflict(self, version):
if not self._in_less_than(version):
- return '< %f' % self.less_than
+ return '< %s' % str(self.less_than)
elif not self._in_greater_than(version):
- return '> %f' % self.greater_than
+ return '> %s' % str(self.greater_than)
else:
return None
@@ -140,11 +140,14 @@ def find_build_deps(source, name, version=None):
build_deps[r.project_name] = Dependency()
for (op, version) in r.specs:
- version = float(version) # >.>
+ version = pkg_resources.parse_version(version)
+
#if no_conflict(requirements_versions_map[r.project_name], s):
# requirements_versions_map[r.project_name] += s
dep = build_deps[r.project_name]
+ print('dep.excludes: %s' % str(dep.excludes))
+
if op == '==':
if dep.is_unconstrained():
dep.set_absolute_version(version)
@@ -153,29 +156,32 @@ def find_build_deps(source, name, version=None):
if dep.in_bounds(version):
dep.set_absolute_version(version)
else:
- error('conflict! == %f conflicts with %s'
+ warn('conflict! == %s conflicts with %s'
% (version,
dep.get_bounds_conflict(version)))
else:
- error('conflict! == %f conflicts with == %f'
+ warn('conflict! == %s conflicts with == %s'
% (version, dep.absolute))
+ elif version in dep.excludes:
+ warn('conflict! == %s conflicts with != %s'
+ % (version, version))
elif version > dep.less_than:
# conflict
- error('conflict! == %f conflicts with < %f'
+ warn('conflict! == %s conflicts with < %s'
% (version, dep.less_than))
elif version < dep.greater_than:
# conflict
- error('conflict! == %f conflicts with > %f'
+ warn('conflict! == %s conflicts with > %s'
% (version, dep.greater_than))
elif op == '!=':
- dep.excludes += version
+ dep.excludes.append(version)
elif op == '<':
if dep.is_unconstrained():
dep.less_than = version
elif dep.greater_than >= version:
# conflict #(our minimum version is greater
# than this greater_than version)
- error('conflict! > %f conflicts with < %f'
+ warn('conflict! > %s conflicts with < %s'
% (dep.greater_than, version))
else:
dep.less_than = version
@@ -185,7 +191,7 @@ def find_build_deps(source, name, version=None):
elif dep.less_than <= version:
# conflict (our maximum version is less than this
# less_than version)
- error('conflict! < %f conflicts with > %f'
+ warn('conflict! < %s conflicts with > %s'
% (dep.less_than, version))
# Resolve versions