Merge lp:~salgado/linaro-image-tools/use-cmd-runner into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 197
Proposed branch: lp:~salgado/linaro-image-tools/use-cmd-runner
Merge into: lp:linaro-image-tools/11.11
Diff against target: 53 lines (+11/-16)
2 files modified
media_create/remove_binary_dir.py (+5/-8)
media_create/unpack_binary_tarball.py (+6/-8)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/use-cmd-runner
Reviewer Review Type Date Requested Status
Martin Ohlsson (community) Approve
Review via email: mp+43753@code.launchpad.net

Description of the change

Update a couple modules using subprocess.Popen() when they should use
cmd_runner.run.

To post a comment you must log in.
Revision history for this message
Martin Ohlsson (martin-ohlson) wrote :

No problems there.

/Martin

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'media_create/remove_binary_dir.py'
2--- media_create/remove_binary_dir.py 2010-12-01 09:06:53 +0000
3+++ media_create/remove_binary_dir.py 2010-12-15 11:41:54 +0000
4@@ -1,16 +1,13 @@
5-#!/usr/bin/python
6-
7 import sys
8 import os.path
9-import subprocess
10+
11+from media_create import cmd_runner
12+
13
14 def remove_binary_dir(binary_dir='binary/', as_root=True):
15 if os.path.exists(binary_dir):
16- args = []
17- if as_root:
18- args.extend(['sudo'])
19- args.extend(['rm', '-rf', binary_dir])
20- proc = subprocess.Popen(args)
21+ proc = cmd_runner.run(
22+ ['rm', '-rf', binary_dir], as_root=as_root)
23 proc.wait()
24 return proc.returncode
25 return 0
26
27=== modified file 'media_create/unpack_binary_tarball.py'
28--- media_create/unpack_binary_tarball.py 2010-11-27 08:27:20 +0000
29+++ media_create/unpack_binary_tarball.py 2010-12-15 11:41:54 +0000
30@@ -1,17 +1,15 @@
31-#!/usr/bin/python
32-
33 import sys
34-import subprocess
35+
36+from media_create import cmd_runner
37+
38
39 def unpack_binary_tarball(tarball, as_root=True):
40- args = []
41- if as_root:
42- args.extend(['sudo'])
43- args.extend(['tar', '--numeric-owner', '-xf', tarball])
44- proc = subprocess.Popen(args)
45+ proc = cmd_runner.run(
46+ ['tar', '--numeric-owner', '-xf', tarball], as_root=as_root)
47 proc.wait()
48 return proc.returncode
49
50+
51 if __name__ == '__main__':
52 if len(sys.argv) != 2:
53 print 'usage: ' + sys.argv[0] + ' <BINARY_TARBALL>'

Subscribers

People subscribed via source and target branches