Skip to content

Commit

Permalink
Nolonger lose information whith compound specs.
Browse files Browse the repository at this point in the history
When a compound spec is found, like tornado>=1.0,<=1.1 multiple entries will be
added to the dependency list:

tornado >= 1.0 and tornado <= 1.1

Because that seems to work for the debian dependency specification.
  • Loading branch information
specialunderwear committed Apr 12, 2012
1 parent 7b4dd7f commit 6f1cf01
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lib/fpm/package/pyfpm/get_metadata.py
Expand Up @@ -8,16 +8,6 @@
# possible some of my techniques below are outdated or bad.
# If you have fixes, let me know.

def select_smallest(first, second):
first_operator, first_version = first
second_operator, second_version = second
if second_operator < first_operator:
return second
elif second_operator == first_operator and second_version < first_version:
return second

return first


class get_metadata(Command):
description = "get package metadata"
Expand Down Expand Up @@ -58,15 +48,15 @@ def run(self):
# end if

final_deps = []
for dep in pkg_resources.parse_requirements(self.distribution.install_requires):
try:
operator, version = reduce(select_smallest, dep.specs)
for dep in pkg_resources.parse_requirements(self.distribution.install_requires):
# add all defined specs to the dependecy list separately.
for operator, version in dep.specs:
final_deps.append("%s %s %s" % (
dep.project_name,
"=" if operator == "==" else operator,
version
))
except TypeError as e:
else:
final_deps.append(dep.project_name)

data["dependencies"] = final_deps
Expand Down

0 comments on commit 6f1cf01

Please sign in to comment.