[Treepkg-commits] r411 - in trunk: bin treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Aug 13 16:16:51 CEST 2010
Author: bricks
Date: 2010-08-13 16:16:50 +0200 (Fri, 13 Aug 2010)
New Revision: 411
Modified:
trunk/bin/publishdebianpackages.py
trunk/treepkg/run.py
Log:
capture only stdout for treepkginfo
Modified: trunk/bin/publishdebianpackages.py
===================================================================
--- trunk/bin/publishdebianpackages.py 2010-08-11 07:45:26 UTC (rev 410)
+++ trunk/bin/publishdebianpackages.py 2010-08-13 14:16:50 UTC (rev 411)
@@ -18,7 +18,7 @@
import treepkgcmd
from treepkg.readconfig import read_config_section, convert_bool
-from treepkg.run import call, capture_output
+from treepkg.run import call, capture_stdout
from treepkg.cmdexpand import cmdexpand
from treepkg.publish import copy_arch_to_publishdir, prefix_for_remote_command,\
get_binary_arch
@@ -76,7 +76,7 @@
def get_treepkg_info(variables):
runremote = prefix_for_remote_command(variables["build_user"],
variables["build_host"])
- xml = capture_output(cmdexpand("@runremote $build_listpackages"
+ xml = capture_stdout(cmdexpand("@runremote $build_listpackages"
" --newest=$num_newest"
" --only-successful",
runremote=runremote,
Modified: trunk/treepkg/run.py
===================================================================
--- trunk/treepkg/run.py 2010-08-11 07:45:26 UTC (rev 410)
+++ trunk/treepkg/run.py 2010-08-13 14:16:50 UTC (rev 411)
@@ -67,3 +67,17 @@
if proc.returncode != 0:
raise SubprocessError(command, proc.returncode, output)
return output
+
+def capture_stdout(command, **kw):
+ """Return the stdout and stderr of the command as a string
+
+ The command should be given as a list of strings to avoid problems
+ with shell quoting. If the command exits with a return code other
+ than 0, a SubprocessError is raised.
+ """
+ proc = subprocess.Popen(command, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, **kw)
+ output, error = proc.communicate()
+ if proc.returncode != 0:
+ raise SubprocessError(command, proc.returncode, error)
+ return output
More information about the Treepkg-commits
mailing list