Class: FPM::Package::Python

Inherits:
FPM::Package show all
Defined in:
lib/fpm/package/python.rb

Overview

Support for python packages.

This supports input, but not output.

Example:

# Download the django python package:
pkg = FPM::Package::Python.new
pkg.input("Django")

Instance Attribute Summary

Attributes inherited from FPM::Package

#architecture, #attributes, #attrs, #category, #config_files, #conflicts, #dependencies, #description, #directories, #epoch, #iteration, #license, #maintainer, #name, #provides, #replaces, #scripts, #url, #vendor, #version

Instance Method Summary collapse

Methods inherited from FPM::Package

apply_options, #build_path, #cleanup, #cleanup_build, #cleanup_staging, #convert, #converted_from, default_attributes, #edit_file, #files, inherited, #initialize, option, #output, #script, #staging_path, #to_s, #type, type, types

Methods included from Util

#ar_cmd, #ar_cmd_deterministic?, #copied_entries, #copy_entry, #copy_metadata, #default_shell, #erbnew, #execmd, #expand_pessimistic_constraints, #logger, #program_exists?, #program_in_path?, #safesystem, #safesystemout, #tar_cmd, #tar_cmd_supports_sort_names_and_set_mtime?

Constructor Details

This class inherits a constructor from FPM::Package

Instance Method Details

#input(package) ⇒ Object

Input a package.

The ‘package’ can be any of:

  • A name of a package on pypi (ie; easy_install some-package)

  • The path to a directory containing setup.py

  • The path to a setup.py



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/fpm/package/python.rb', line 97

def input(package)
  path_to_package = download_if_necessary(package, version)

  if File.directory?(path_to_package)
    setup_py = File.join(path_to_package, "setup.py")
  else
    setup_py = path_to_package
  end

  if !File.exist?(setup_py)
    logger.error("Could not find 'setup.py'", :path => setup_py)
    raise "Unable to find python package; tried #{setup_py}"
  end

  load_package_info(setup_py)
  install_to_staging(setup_py)
end