Merge lp:~gary/charms/precise/juju-gui/run-without-ppa into lp:~juju-gui/charms/precise/juju-gui/trunk
Proposed by
Gary Poster
Status: | Merged |
---|---|
Merged at revision: | 22 |
Proposed branch: | lp:~gary/charms/precise/juju-gui/run-without-ppa |
Merge into: | lp:~juju-gui/charms/precise/juju-gui/trunk |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp:~gary/charms/precise/juju-gui/run-without-ppa |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+142568@code.launchpad.net |
Description of the change
Make charm work without environment Juju PPA
As discovered by therve and myself, the charm does not work if "juju-origin: ppa" is not in your environments.yaml for the given Juju environment. These changes work around the problem.
To post a comment you must log in.
Reviewers: mp+142568_ code.launchpad. net,
Message:
Please take a look.
Description:
Make charm work without environment Juju PPA
As discovered by therve and myself, the charm does not work if
"juju-origin: ppa" is not in your environments.yaml for the given Juju
environment. These changes work around the problem.
https:/ /code.launchpad .net/~gary/ charms/ precise/ juju-gui/ run-without- ppa/+merge/ 142568
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7073051/
Affected files: _utils. py
A [revision details]
A hooks/bootstrap
M hooks/install
M revision
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: revision
=== modified file 'revision'
--- revision 2013-01-03 20:16:28 +0000
+++ revision 2013-01-09 18:12:09 +0000
@@ -1,1 +1,1 @@
-18
+19
Index: hooks/bootstrap _utils. py bootstrap_ utils.py' _utils. py 1970-01-01 00:00:00 +0000 _utils. py 2013-01-09 18:12:09 +0000 shelltoolbox. Precise does not kwargs. pop('stdout' , pipe), kwargs. pop('stderr' , pipe), kwargs. pop('close_ fds', True), **kwargs) communicate( ) CalledProcessEr ror( rror` was introduced filter( None, [stdout, stderr])) extra_repositor ies(*repositori es): CalledProcessEr ror repository` is interactive by
=== added file 'hooks/
--- hooks/bootstrap
+++ hooks/bootstrap
@@ -0,0 +1,54 @@
+# These are actually maintained in python-
have
+# that package, so we need to bootstrap the process by copying the
functions
+# we need here.
+
+import subprocess
+
+try:
+ import shelltoolbox
+except ImportError:
+ def run(*args, **kwargs):
+ """Run the command with the given arguments.
+
+ The first argument is the path to the command to run.
+ Subsequent arguments are command-line arguments to be passed.
+
+ This function accepts all optional keyword arguments accepted by
+ `subprocess.Popen`.
+ """
+ args = [i for i in args if i is not None]
+ pipe = subprocess.PIPE
+ process = subprocess.Popen(
+ args, stdout=
+ stderr=
+ close_fds=
+ stdout, stderr = process.
+ if process.returncode:
+ exception = subprocess.
+ process.returncode, repr(args))
+ # The output argument of `CalledProcessE
in Python
+ # 2.7. Monkey patch the output here to avoid TypeErrors in
older
+ # versions of Python, still preserving the output in Python
2.7.
+ exception.output = ''.join(
+ raise exception
+ return stdout
+
+ def install_
+ """Install all of the extra repositories and update apt.
+
+ Given repositories can contain a "{distribution}" placeholder,
that will
+ be replaced by current distribution codename.
+
+ :raises: subprocess.
+ """
+ distribution = run('lsb_release', '-cs').strip()
+ # Starting from Oneiric, `apt-add-
+ # ...