W3C home > Mailing lists > Public > public-svg-wg@w3.org > October to December 2014

[svgwg] Hopefully fix build script for windows

From: SVG Working Group repository <cam+svgwgrepo@mcc.id.au>
Date: Thu, 9 Oct 2014 18:49:57 -0700 (PDT)
To: public-svg-wg@w3.org
Message-Id: <20141010014957.551EF890AC4FE@ps58493.dreamhostps.com>
https://github.com/w3c/svgwg/commit/e8ce4c5199b41b276d76409197465f88439e988f
commit e8ce4c5199b41b276d76409197465f88439e988f
Author: Brian Birtles <birtles@gmail.com>
Date:   Fri Oct 10 10:46:57 2014 +0900

    Hopefully fix build script for windows

diff --git a/tools/build.py b/tools/build.py
index 352bbd1..ff0354a 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -45,6 +45,26 @@ def getstatus(cmd):
     status, output = getstatusoutput(cmd)
     return status
 
+def which(name, flags=os.X_OK):
+    """ which that works on Windows too.
+    
+    Based on http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/python/procutils.py
+    """
+    result = []
+    exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
+    path = os.environ.get('PATH', None)
+    if path is None:
+        return []
+    for p in os.environ.get('PATH', '').split(os.pathsep):
+        p = os.path.join(p, name)
+        if os.access(p, flags):
+            result.append(p)
+        for e in exts:
+            pext = p + e
+            if os.access(pext, flags):
+                result.append(pext)
+    return result
+
 # could allow this to be passed in:
 repo_dir = os.getcwd()
 
@@ -114,10 +134,9 @@ if len(sys.argv) == 2 and sys.argv[1] == "-c":
 
 # See if we should call "node" or "nodejs":
 
-status, output = getstatusoutput("which nodejs")
-if getstatus("which nodejs") == 0:
+if which("nodejs") != []:
     node = "nodejs"
-elif getstatus("which node") == 0:
+elif which("node") != []:
     node = "node"
 elif getstatus("[ -e /home/svgwg/bin/node ]") == 0:
     node = "/home/svgwg/bin/node"


============================================================
/home/svgwg/bin/node "/home/svgwg/svgwg.org/git/svgwg/tools/publish/publish.js" --list-pages
Nothing to do.
Received on Friday, 10 October 2014 01:50:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:20 UTC