--- a/build.py Mon Aug 06 11:51:08 2012 +1000
+++ b/build.py Mon Aug 06 16:46:50 2012 +0900
@@ -37,6 +37,19 @@
return commands.getoutput("cygpath -a -w %s" % s)
return s
+# Multiplatform alternative to commands.getstatusoutput from
+# http://stackoverflow.com/questions/1193583/what-is-the-multiplatform-alternative-to-subprocess-getstatusoutput-older-comma
+def getstatusoutput(cmd):
+ """Return (status, output) of executing cmd in a shell."""
+ """This new implementation should work on all platforms."""
+ import subprocess
+ pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
+ universal_newlines=True)
+ output = "".join(pipe.stdout.readlines())
+ sts = pipe.returncode
+ if sts is None: sts = 0
+ return sts, output
+
# could allow this to be passed in:
repo_dir = os.getcwd()
@@ -106,7 +119,7 @@
# Get all the pages from publish.xml:
os.chdir(master_dir)
-status, output = commands.getstatusoutput("node \"" +
+status, output = getstatusoutput("node \"" +
native_path(join(tools_dir, "publish/publish.js")) + "\" --list-pages")
os.chdir(repo_dir)
if status != 0: