Merge lp:~markgius/horizon/lp785989 into lp:~hudson-openstack/horizon/trunk

Proposed by Mark Gius
Status: Merged
Approved by: Devin Carlen
Approved revision: 52
Merged at revision: 52
Proposed branch: lp:~markgius/horizon/lp785989
Merge into: lp:~hudson-openstack/horizon/trunk
Prerequisite: lp:~markgius/horizon/lp727414
Diff against target: 47 lines (+18/-5)
1 file modified
openstack-dashboard/tools/install_venv.py (+18/-5)
To merge this branch: bzr merge lp:~markgius/horizon/lp785989
Reviewer Review Type Date Requested Status
Devin Carlen Approve
Review via email: mp+62051@code.launchpad.net

Description of the change

Updates check_dependencies to properly report error messages when easy_install and virtualenv are both missing, and add in an attempt to install virtualenv using easy_install before giving up. Better error messages and error typos fixed.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openstack-dashboard/tools/install_venv.py'
2--- openstack-dashboard/tools/install_venv.py 2011-05-23 22:57:25 +0000
3+++ openstack-dashboard/tools/install_venv.py 2011-05-23 22:57:25 +0000
4@@ -38,7 +38,8 @@
5 sys.exit(1)
6
7
8-def run_command(cmd, redirect_output=True, check_exit_code=True, cwd=ROOT):
9+def run_command(cmd, redirect_output=True, check_exit_code=True, cwd=ROOT,
10+ die_message=None):
11 """
12 Runs a command in an out-of-process shell, returning the
13 output of that command. Working directory is ROOT.
14@@ -51,7 +52,10 @@
15 proc = subprocess.Popen(cmd, cwd=cwd, stdout=stdout)
16 output = proc.communicate()[0]
17 if check_exit_code and proc.returncode != 0:
18- die('Command "%s" failed.\n%s', ' '.join(cmd), output)
19+ if die_message is None:
20+ die('Command "%s" failed.\n%s', ' '.join(cmd), output)
21+ else:
22+ die(die_message)
23 return output
24
25
26@@ -70,11 +74,20 @@
27 # Try installing it via easy_install...
28 if HAS_EASY_INSTALL:
29 print 'Installing virtualenv via easy_install...',
30+ run_command(['easy_install', 'virtualenv'],
31+ die_message='easy_install failed to install virtualenv'
32+ '\ndevelopment requires virtualenv, please'
33+ ' install it using your favorite tool')
34 if not run_command(['which', 'virtualenv']):
35- die('ERROR: virtualenv not found.\n\nevelopment requires'
36- ' virtualenv, please install it using your favorite'
37- ' package management tool')
38+ die('ERROR: virtualenv not found in path.\n\ndevelopment '
39+ ' requires virtualenv, please install it using your'
40+ ' favorite package management tool and ensure'
41+ ' virtualenv is in your path')
42 print 'virtualenv installation done.'
43+ else:
44+ die('easy_install not found.\n\nInstall easy_install'
45+ ' (python-setuptools in ubuntu) or virtualenv by hand,'
46+ ' then rerun.')
47 print 'dependency check done.'
48
49

Subscribers

People subscribed via source and target branches