Class: Circus::Profiles::PythonBase

Inherits:
Base
  • Object
show all
Defined in:
lib/circus/profiles/python_base.rb

Direct Known Subclasses

Django, PurePy

Instance Method Summary collapse

Methods inherited from Base

#cleanup_after_deploy, #extra_dirs, #initialize, #mark_for_persistent_run?, #package_base_dir?, #package_for_deploy, #package_for_dev, #requirements, #supported_for_development?

Constructor Details

This class inherits a constructor from Circus::Profiles::Base

Instance Method Details

#prepare_for_deploy(logger, overlay_dir) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/circus/profiles/python_base.rb', line 11

def prepare_for_deploy(logger, overlay_dir)
  # Build the virtualenv
  unless File.exists? "#{@dir}/vendor"
    return false unless run_external(logger, "Create virtualenv", "cd #{@dir}; virtualenv --no-site-packages vendor")
  end

  if has_depsfile?
    File.read(depsfile_fn).lines.each do |dep|
      return false unless run_external(logger, "Install dep #{dep}", 
          "cd #{@dir}; vendor/bin/easy_install -q \"#{dep.strip}\"")
    end

    return false unless run_external(logger, "Make virtualenv relocatable", "cd #{@dir}; virtualenv --relocatable vendor")
  end
  
  true
end

#prepare_for_dev(logger, run_dir) ⇒ Object

Development preparation is the same as deployment



7
8
9
# File 'lib/circus/profiles/python_base.rb', line 7

def prepare_for_dev(logger, run_dir)
  prepare_for_deploy(logger, run_dir)
end