Check whether node should be called as "node" or "nodejs".
--- a/build.py Sat Feb 01 12:44:24 2014 +1100
+++ b/build.py Tue Apr 01 11:14:13 2014 +1100
@@ -41,6 +41,10 @@
if sts is None: sts = 0
return sts, output
+def getstatus(cmd):
+ status, output = getstatusoutput(cmd)
+ return status
+
# could allow this to be passed in:
repo_dir = os.getcwd()
@@ -109,10 +113,20 @@
os.rmdir(join(parent, dir))
sys.exit(0)
+# See if we should call "node" or "nodejs":
+
+status, output = getstatusoutput("which nodejs")
+if getstatus("which nodejs") == 0:
+ node = "nodejs"
+elif getstatus("which node") == 0:
+ node = "node"
+else:
+ exit(1, 'FAIL: could not find "nodejs" or "node" on the PATH')
+
# Get all the pages and resources from publish.xml:
os.chdir(master_dir)
-status, output = getstatusoutput("node \"" +
+status, output = getstatusoutput(node + " \"" +
native_path(join(tools_dir, "publish/publish.js")) + "\" --list-pages")
os.chdir(repo_dir)
if status != 0:
@@ -121,7 +135,7 @@
all = output.split()
os.chdir(master_dir)
-status, output = getstatusoutput("node \"" +
+status, output = getstatusoutput(node + " \"" +
native_path(join(tools_dir, "publish/publish.js")) + "\" --list-resources")
os.chdir(repo_dir)
if status != 0:
@@ -159,7 +173,7 @@
if tobuild:
toremove = tobuild
os.chdir(master_dir)
- run("node \"" +
+ run(node + " \"" +
native_path(join(tools_dir, join("publish","publish.js"))) +
"\" --build " +
" ".join(tobuild_names) +
@@ -184,7 +198,7 @@
if buildSinglePage:
os.chdir(master_dir)
- run("node \"" +
+ run(node + " \"" +
native_path(join(tools_dir, join("publish","publish.js"))) +
"\" --build-single-page")
os.chdir(repo_dir) # chdir back