class PoisePython::Resources::PythonPackage::Resource

A `python_package` resource to manage Python installations using pip.

@provides python_package @action install @action upgrade @action uninstall @example

python_package 'django' do
  python '2'
  version '1.8.3'
end

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/poise_python/resources/python_package.rb, line 127
def initialize(*args)
  super
  # For older Chef.
  @resource_name = :python_package
  # We don't have these actions.
  @allowed_actions.delete(:purge)
  @allowed_actions.delete(:reconfig)
end

Public Instance Methods

response_file(arg=nil) click to toggle source

Upstream attribute we don't support. Sets are an error and gets always return nil.

@api private @param arg [Object] Ignored @return [nil]

# File lib/poise_python/resources/python_package.rb, line 142
def response_file(arg=nil)
  raise NoMethodError if arg
end
response_file_variables(arg=nil) click to toggle source

(see response_file)

# File lib/poise_python/resources/python_package.rb, line 147
def response_file_variables(arg=nil)
  raise NoMethodError if arg && arg != {}
end
source(arg=nil) click to toggle source

(see response_file)

# File lib/poise_python/resources/python_package.rb, line 152
def source(arg=nil)
  raise NoMethodError if arg
end

Private Instance Methods

default_group() click to toggle source

Find a default group, if any, from the parent Python.

@api private @return [String, Integer, nil]

# File lib/poise_python/resources/python_package.rb, line 162
def default_group
  # Use an explicit is_a? hack because python_runtime is a container so
  # it gets the whole DSL and this will always respond_to?(:group).
  if parent_python && parent_python.is_a?(PoisePython::Resources::PythonVirtualenv::Resource)
    parent_python.group
  else
    nil
  end
end
default_user() click to toggle source

Find a default user, if any, from the parent Python.

@api private @return [String, Integer, nil]

# File lib/poise_python/resources/python_package.rb, line 176
def default_user
  # See default_group for explanation of is_a? hack grossness.
  if parent_python && parent_python.is_a?(PoisePython::Resources::PythonVirtualenv::Resource)
    parent_python.user
  else
    nil
  end
end