~gnuoy/charms/trusty/keystone/delete-quantum-ep

« back to all changes in this revision

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

  • Committer: Corey Bryant
  • Date: 2016-01-04 21:27:51 UTC
  • Revision ID: corey.bryant@canonical.com-20160104212751-th8290dpour7yu5q
[corey.bryant,r=trivial] Sync charm-helpers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
            yield "--{0}={1}".format(key, value)
43
43
 
44
44
 
45
 
def pip_install_requirements(requirements, **options):
46
 
    """Install a requirements file """
 
45
def pip_install_requirements(requirements, constraints=None, **options):
 
46
    """Install a requirements file.
 
47
 
 
48
    :param constraints: Path to pip constraints file.
 
49
    http://pip.readthedocs.org/en/stable/user_guide/#constraints-files
 
50
    """
47
51
    command = ["install"]
48
52
 
49
53
    available_options = ('proxy', 'src', 'log', )
51
55
        command.append(option)
52
56
 
53
57
    command.append("-r {0}".format(requirements))
54
 
    log("Installing from file: {} with options: {}".format(requirements,
55
 
                                                           command))
 
58
    if constraints:
 
59
        command.append("-c {0}".format(constraints))
 
60
        log("Installing from file: {} with constraints {} "
 
61
            "and options: {}".format(requirements, constraints, command))
 
62
    else:
 
63
        log("Installing from file: {} with options: {}".format(requirements,
 
64
                                                               command))
56
65
    pip_execute(command)
57
66
 
58
67