Merge lp:~danilo/linaro-license-protection/python26-compat into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Данило Шеган
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 118
Merged at revision: 116
Proposed branch: lp:~danilo/linaro-license-protection/python26-compat
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 64 lines (+22/-6)
2 files modified
scripts/linaroscript.py (+3/-1)
scripts/update-deployment.py (+19/-5)
To merge this branch: bzr merge lp:~danilo/linaro-license-protection/python26-compat
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Review via email: mp+121061@code.launchpad.net

Description of the change

python2.6 compat for lucid.

subprocess module has no call_output() and a few other small tidbits.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

What, no tests for the deploy script changes?

:p

review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Shush. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/linaroscript.py'
2--- scripts/linaroscript.py 2012-08-22 22:27:28 +0000
3+++ scripts/linaroscript.py 2012-08-23 17:19:22 +0000
4@@ -55,8 +55,10 @@
5 if verbosity == 0:
6 logging_level = logging.ERROR
7 elif verbosity == 1:
8+ logging_level = logging.WARNING
9+ elif verbosity == 2:
10 logging_level = logging.INFO
11- elif verbosity >= 2:
12+ elif verbosity >= 3:
13 logging_level = logging.DEBUG
14 else:
15 logging_level = logging.ERROR
16
17=== modified file 'scripts/update-deployment.py'
18--- scripts/update-deployment.py 2012-08-22 22:27:28 +0000
19+++ scripts/update-deployment.py 2012-08-23 17:19:22 +0000
20@@ -1,4 +1,4 @@
21-#!/usr/bin/env python2.7
22+#!/usr/bin/env python
23
24 """Update a deployment of lp:linaro-license-protection.
25
26@@ -84,6 +84,20 @@
27 code_tree = bzrlib.workingtree.WorkingTree.open(working_tree_dir)
28 code_tree.update()
29
30+ def run_subcommand(self, arguments, cwd=None):
31+ process = subprocess.Popen(arguments, cwd=cwd, stdout=subprocess.PIPE,
32+ stderr=subprocess.PIPE)
33+ process_out, process_err = process.communicate()
34+ if process_out is not None:
35+ self.logger.debug(
36+ "stdout:\n" + "\n\t".join(process_out.splitlines()))
37+ if process_err is not None:
38+ self.logger.debug(
39+ "stderr:\n" + "\n\t".join(process_err.splitlines()))
40+ if process.returncode != 0:
41+ self.logger.error(
42+ "FAILED %d", process.returncode)
43+
44 def update_installation(self, config, installation_root):
45 """Updates a single installation code and databases.
46
47@@ -108,13 +122,13 @@
48 os.environ.get("DJANGO_SETTINGS_MODULE"))
49
50 self.logger.debug("Doing 'syncdb'...")
51- self.logger.debug(subprocess.check_output(
52- ["django-admin", "syncdb", "--noinput"], cwd=code_root))
53+ self.run_subcommand(
54+ ["django-admin", "syncdb", "--noinput"], cwd=code_root)
55
56 self.logger.debug("Doing 'collectstatic'...")
57- self.logger.debug(subprocess.check_output(
58+ self.run_subcommand(
59 ["django-admin", "collectstatic", "--noinput"],
60- cwd=code_root))
61+ cwd=code_root)
62
63 def setup_parser(self):
64 super(UpdateDeploymentScript, self).setup_parser()

Subscribers

People subscribed via source and target branches