Merge lp:~pwlars/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-pip into lp:~canonical-ci-engineering/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker

Proposed by Paul Larson
Status: Merged
Approved by: Chris Johnston
Approved revision: 10
Merged at revision: 10
Proposed branch: lp:~pwlars/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-pip
Merge into: lp:~canonical-ci-engineering/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker
Diff against target: 48 lines (+19/-0)
2 files modified
config.yaml (+3/-0)
hooks/hooks.py (+16/-0)
To merge this branch: bzr merge lp:~pwlars/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-pip
Reviewer Review Type Date Requested Status
Chris Johnston (community) Approve
Francis Ginther Approve
Andy Doan (community) Approve
Review via email: mp+203186@code.launchpad.net

Commit message

Add an option to take a list of pip packages to install

Description of the change

Add an option to take a list of pip packages to install

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) :
review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

looks good.

review: Approve
Revision history for this message
Chris Johnston (cjohnston) wrote :

 merge approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-01-16 16:48:47 +0000
3+++ config.yaml 2014-01-24 22:18:45 +0000
4@@ -8,6 +8,9 @@
5 packages:
6 type: string
7 description: "Packages required for this service"
8+ pip-packages:
9+ type: string
10+ description: "Pip packages required for this service"
11 install_root:
12 type: string
13 description: "The root directory the service will be installed in"
14
15=== modified file 'hooks/hooks.py'
16--- hooks/hooks.py 2014-01-16 16:48:47 +0000
17+++ hooks/hooks.py 2014-01-24 22:18:45 +0000
18@@ -40,14 +40,30 @@
19 return os.path.join(config['install_root'], _service_name(config))
20
21
22+def pip_install(package):
23+ cmd_line = ['pip', 'install', '-b', '/tmp/']
24+ if package.startswith('svn+') or package.startswith('git+') or \
25+ package.startswith('hg+') or package.startswith('bzr+'):
26+ cmd_line.append('-e')
27+ cmd_line.append(package)
28+ return(subprocess.call(cmd_line))
29+
30+
31 def install(config):
32 pkgs = [x for x in config.get('packages', '').split(' ') if x]
33 pkgs.append('python-amqplib')
34+ pkgs.append('python-pip')
35 pkgs.append('bzr')
36
37 juju_info('installing apt packages...')
38 subprocess.check_call(['apt-get', 'install', '-y', '-q'] + pkgs)
39
40+ pip_pkgs = [x for x in config.get('pip-packages', '').split(' ') if x]
41+ if pip_pkgs:
42+ juju_info('installing pip packages...')
43+ for package in pip_pkgs:
44+ pip_install(package.strip())
45+
46 juju_info('grabbing service from bzr...')
47 args = ['bzr', 'branch']
48 rev = config.get('revno', '')

Subscribers

People subscribed via source and target branches