* Fix #263 Convert != dependency as Conflict =, as rpm doesn't understand it #312

Merged
merged 1 commit into from Jan 2, 2013
Jump to file or symbol
Failed to load files and symbols.
+15 −1
Diff settings

Always

Just for now

@@ -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
@@ -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)