~james-page/charms/trusty/swift-proxy/kilo

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/python/packages.py

  • Committer: Liam Young
  • Date: 2015-01-26 09:45:43 UTC
  • Revision ID: liam.young@canonical.com-20150126094543-r9gy9y3tokm27otx
[gnuoy,trivial] Pre-release charmhelper sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
# coding: utf-8
3
3
 
 
4
# Copyright 2014-2015 Canonical Limited.
 
5
#
 
6
# This file is part of charm-helpers.
 
7
#
 
8
# charm-helpers is free software: you can redistribute it and/or modify
 
9
# it under the terms of the GNU Lesser General Public License version 3 as
 
10
# published by the Free Software Foundation.
 
11
#
 
12
# charm-helpers is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU Lesser General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Lesser General Public License
 
18
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
4
20
__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
5
21
 
6
22
from charmhelpers.fetch import apt_install, apt_update
35
51
    pip_execute(command)
36
52
 
37
53
 
38
 
def pip_install(package, fatal=False, **options):
 
54
def pip_install(package, fatal=False, upgrade=False, **options):
39
55
    """Install a python package"""
40
56
    command = ["install"]
41
57
 
43
59
    for option in parse_options(options, available_options):
44
60
        command.append(option)
45
61
 
 
62
    if upgrade:
 
63
        command.append('--upgrade')
 
64
 
46
65
    if isinstance(package, list):
47
66
        command.extend(package)
48
67
    else: