~ubuntu-branches/ubuntu/trusty/cinder/trusty

« back to all changes in this revision

Viewing changes to tools/install_venv_common.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chuck Short, James Page
  • Date: 2013-03-16 09:30:20 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130316093020-xnaqjbr18uhkti6l
Tags: 1:2013.1~rc1-0ubuntu1
[ Chuck Short ]
* debian/patches/fix-ubuntu-tests.patch: Dropped.
* debian/rules: Fix version number when building the testsuite. 
* debian/cinder-backup{.install, upstart, logroate}: Add cinder-backup
  service.
* debian/rules: Run the testsuite against PYTHONPATH.
* debian/control: Update build-depends and run-time depends.
  - Dropped python-glance not needed.
  - Dropped python-cheetah not needed.
  - Droped python-daemon not needed.
  - Dropped python-netaddr not needed.
  - Renamed python-oslo-config to python-oslo.config.
  - Added python-keystoneclient to depends.
  - Added python-swiftclient to depends.
 * debian/pydist-overrides: No longer needed.

[ James Page ]
* New upstream release candidate.
* d/watch: Update uversionmangle to deal with upstream versioning
  changes, remove tarballs.openstack.org.
* d/cinder.conf: Set lock_path to /var/lock/cinder (default is not
  sensible).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
Synced in from openstack-common
22
22
"""
23
23
 
 
24
import argparse
24
25
import os
25
26
import subprocess
26
27
import sys
27
28
 
28
 
possible_topdir = os.getcwd()
29
 
if os.path.exists(os.path.join(possible_topdir, "cinder",
30
 
                               "__init__.py")):
31
 
    sys.path.insert(0, possible_topdir)
32
 
 
33
 
 
34
 
from oslo.config import cfg
35
 
 
36
29
 
37
30
class InstallVenv(object):
38
31
 
57
50
                              check_exit_code=True):
58
51
        """Runs a command in an out-of-process shell.
59
52
 
60
 
        Returns the output of that command. Working directory is ROOT.
 
53
        Returns the output of that command. Working directory is self.root.
61
54
        """
62
55
        if redirect_output:
63
56
            stdout = subprocess.PIPE
100
93
            else:
101
94
                self.run_command(['virtualenv', '-q', self.venv])
102
95
            print 'done.'
103
 
            print 'Installing pip in virtualenv...',
 
96
            print 'Installing pip in venv...',
104
97
            if not self.run_command(['tools/with_venv.sh', 'easy_install',
105
98
                                    'pip>1.0']).strip():
106
99
                self.die("Failed to install pip.")
138
131
 
139
132
    def parse_args(self, argv):
140
133
        """Parses command-line arguments."""
141
 
        cli_opts = [
142
 
            cfg.BoolOpt('no-site-packages',
143
 
                        default=False,
144
 
                        short='n',
145
 
                        help="Do not inherit packages from global Python"
146
 
                             "install"),
147
 
        ]
148
 
        CLI = cfg.ConfigOpts()
149
 
        CLI.register_cli_opts(cli_opts)
150
 
        CLI(argv[1:])
151
 
        return CLI
 
134
        parser = argparse.ArgumentParser()
 
135
        parser.add_argument('-n', '--no-site-packages',
 
136
                            action='store_true',
 
137
                            help="Do not inherit packages from global Python "
 
138
                                 "install")
 
139
        return parser.parse_args(argv[1:])
152
140
 
153
141
 
154
142
class Distro(InstallVenv):
197
185
        self.run_command(['sudo', 'yum', 'install', '-y', pkg], **kwargs)
198
186
 
199
187
    def apply_patch(self, originalfile, patchfile):
200
 
        self.run_command(['patch', originalfile, patchfile])
 
188
        self.run_command(['patch', '-N', originalfile, patchfile],
 
189
                         check_exit_code=False)
201
190
 
202
191
    def install_virtualenv(self):
203
192
        if self.check_cmd('virtualenv'):