Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Convert != dependency as Conflict =, as rpm doesn't understand it

* Skip empty lines in requirements.txt
  • Loading branch information...
commit d62662b086b765d195c56d44b767df64d59bf355 1 parent 2d8c7f2
@r4um r4um authored
Showing with 15 additions and 1 deletion.
  1. +2 −1  lib/fpm/package/python.rb
  2. +13 −0 lib/fpm/package/rpm.rb
View
3  lib/fpm/package/python.rb
@@ -182,13 +182,14 @@ def load_package_info(setup_py)
# requirements.txt can have dependencies, flags, and comments.
# We only want the comments, so remove comment and flag lines.
metadata["dependencies"] = File.read(requirements_txt).split("\n") \
+ .reject { |l| l =~ /^\s*$/ } \
.reject { |l| l =~ /^\s*#/ } \
.reject { |l| l =~ /^-/ } \
.map(&:strip)
end
self.dependencies += metadata["dependencies"].collect do |dep|
- dep_re = /^([^<>= ]+)\s*(?:([<>=]{1,2})\s*(.*))?$/
+ dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
match = dep_re.match(dep)
if match.nil?
@logger.error("Unable to parse dependency", :dependency => dep)
View
13 lib/fpm/package/rpm.rb
@@ -141,6 +141,19 @@ def converted_from(origin)
end
#self.provides << "rubygem(#{self.name})"
end
+
+ # Convert != dependency as Conflict =, as rpm doesn't understand !=
+ if origin == FPM::Package::Python
+ self.dependencies = self.dependencies.select do |dep|
+ name, op, version = dep.split(/\s+/)
+ dep_ok = true
+ if op == '!='
+ self.conflicts << "#{name} = #{version}"
+ dep_ok = false
+ end
+ dep_ok
+ end
+ end
end # def converted
def input(path)
Please sign in to comment.
Something went wrong with that request. Please try again.