Permalink
Browse files

Add --python-package-prefix option

Allows the prefix of packages to change to a user specified value.

Useful if you do not want to conflict with other python packages,
or want to install to a special ruby instance
  • Loading branch information...
1 parent bdfee82 commit 01bda528f3916714b8802d0e47b641df0a8da0e0 @tabletcorry tabletcorry committed Aug 18, 2011
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/fpm/source/python.rb
@@ -21,6 +21,12 @@ def self.flags(opts, settings)
"The path to your easy_install tool. Default is 'easy_install'") do |path|
settings.source[:easy_install] = path
end
+
+ opts.on("--package-prefix PREFIX",
+ "Prefix for python packages") do |package_prefix|
+ settings.source[:package_prefix] = package_prefix
+ end
+
end # def flags
def get_source(params)
@@ -78,16 +84,22 @@ def get_metadata
metadata = JSON.parse(output[/\{.*\}/msx])
#p metadata
+ if self[:settings][:package_prefix]
+ self[:package_prefix] = self[:settings][:package_prefix]
+ else
+ self[:package_prefix] = "python"
+ end
+
self[:architecture] = metadata["architecture"]
self[:description] = metadata["description"]
self[:license] = metadata["license"]
self[:version] = metadata["version"]
- self[:name] = "python#{self[:suffix]}-#{metadata["name"]}"
+ self[:name] = "#{self[:package_prefix]}#{self[:suffix]}-#{metadata["name"]}"
self[:url] = metadata["url"]
self[:dependencies] = metadata["dependencies"].collect do |dep|
name, cmp, version = dep.split
- "python#{self[:suffix]}-#{name} #{cmp} #{version}"
+ "#{self[:package_prefix]}#{self[:suffix]}-#{name} #{cmp} #{version}"
end
end # def get_metadata

0 comments on commit 01bda52

Please sign in to comment.