~openstack-charmers-next/charms/wily/keystone/trunk

« back to all changes in this revision

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

  • Committer: James Page
  • Date: 2016-07-06 15:35:04 UTC
  • Revision ID: james.page@ubuntu.com-20160706153504-y5jv4ugzni7uqzhg
Resync charmhelpers for licensing change

The charm-helpers project have re-licensed to Apache 2.0
inline with the agreed licensing approach to intefaces,
layers and charms generally.

Resync helpers to bring charmhelpers inline with charm
codebase.

Change-Id: Icedfb79814e186290a3120d953c9077e4e4504fe

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
# Copyright 2014-2015 Canonical Limited.
5
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/>.
 
6
# Licensed under the Apache License, Version 2.0 (the "License");
 
7
# you may not use this file except in compliance with the License.
 
8
# You may obtain a copy of the License at
 
9
#
 
10
#  http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
# Unless required by applicable law or agreed to in writing, software
 
13
# distributed under the License is distributed on an "AS IS" BASIS,
 
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
# See the License for the specific language governing permissions and
 
16
# limitations under the License.
19
17
 
20
18
import os
21
19
import subprocess
80
78
    pip_execute(command)
81
79
 
82
80
 
83
 
def pip_install(package, fatal=False, upgrade=False, venv=None, **options):
 
81
def pip_install(package, fatal=False, upgrade=False, venv=None,
 
82
                constraints=None, **options):
84
83
    """Install a python package"""
85
84
    if venv:
86
85
        venv_python = os.path.join(venv, 'bin/pip')
95
94
    if upgrade:
96
95
        command.append('--upgrade')
97
96
 
 
97
    if constraints:
 
98
        command.extend(['-c', constraints])
 
99
 
98
100
    if isinstance(package, list):
99
101
        command.extend(package)
100
102
    else: