Fix bug in detecting JS errors; only build single page spec if there is more than one page.
--- a/build.py Sat Apr 06 12:26:03 2013 +1100
+++ b/build.py Sat Apr 06 12:27:17 2013 +1100
@@ -37,7 +37,7 @@
pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
universal_newlines=True)
output = "".join(pipe.stdout.readlines())
- sts = pipe.returncode
+ sts = pipe.wait()
if sts is None: sts = 0
return sts, output
@@ -48,14 +48,18 @@
build_dir = join(repo_dir, 'build')
publish_dir = join(build_dir, 'publish')
tools_dir = normpath(join(repo_dir, '..', 'svg2-tools'))
-publishjs_dir = join(tools_dir, 'publish')
if not exists(master_dir):
- exit(1, 'FAIL: build.py must be run from the root of the \'svg2\' repository')
+ exit(1, 'FAIL: build.py must be run from the root of the \'svg2\' repository '
+ 'or from one of the directories under \'specs/\'.')
if not exists(tools_dir):
- exit(1, 'FAIL: the \'svg2-tools\' repository must be checked out alongside '
- ' the \'svg2\' repository')
+ tools_dir = normpath(join(repo_dir, '..', '..', '..', 'svg2-tools'))
+ if not exists(tools_dir):
+ exit(1, 'FAIL: the \'svg2-tools\' repository must be checked out alongside '
+ 'the \'svg2\' repository')
+
+publishjs_dir = join(tools_dir, 'publish')
if not exists(publish_dir):
assert os.pardir not in publish_dir
@@ -165,24 +169,25 @@
# Build single page spec as required:
-buildSinglePage = False
-single_page = join(publish_dir, "single-page.html")
-
-if not isfile(single_page):
- buildSinglePage = True
-else:
- singlePageTime = getmtime(single_page)
- for name in all:
- if getmtime(join(publish_dir, name + ".html")) > singlePageTime:
- buildSinglePage = True
- break
-
-if buildSinglePage:
- os.chdir(master_dir)
- run("node \"" +
- native_path(join(tools_dir, join("publish","publish.js"))) +
- "\" --build-single-page")
- os.chdir(repo_dir) # chdir back
+if len(all) > 1:
+ buildSinglePage = False
+ single_page = join(publish_dir, "single-page.html")
+
+ if not isfile(single_page):
+ buildSinglePage = True
+ else:
+ singlePageTime = getmtime(single_page)
+ for name in all:
+ if getmtime(join(publish_dir, name + ".html")) > singlePageTime:
+ buildSinglePage = True
+ break
+
+ if buildSinglePage:
+ os.chdir(master_dir)
+ run("node \"" +
+ native_path(join(tools_dir, join("publish","publish.js"))) +
+ "\" --build-single-page")
+ os.chdir(repo_dir) # chdir back
# Copy over anything else that needs to be copied to 'publish':
for f in resources: