aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-10-29 16:21:41 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-10-30 22:01:30 +0100
commit5182542126a5ad3c40d958b0b72cfa16f4e8bd25 (patch)
treed26bfee9fa5d0fca1810a8650e62dc5f16744d3a
parent350550a5ccfacd19f512bca2ded186e143ea9579 (diff)
tools: parse pre-release node.js version numbers
`node` binaries built from upstream git have a "-pre" suffix attached to the version number. Fix the version parser to handle those.
-rw-r--r--AUTHORS2
-rw-r--r--tests/test_sanity.py6
-rw-r--r--tools/shared.py2
3 files changed, 7 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 5ad3f98d..75f38f15 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -104,4 +104,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Daniel Aquino <mr.danielaquino@gmail.com>
* Remi Papillie <remi.papillie@gmail.com>
* Fraser Adams <fraser.adams@blueyonder.co.uk>
-
+* Ben Noordhuis <info@bnoordhuis.nl>
diff --git a/tests/test_sanity.py b/tests/test_sanity.py
index a0fff252..a405c3a3 100644
--- a/tests/test_sanity.py
+++ b/tests/test_sanity.py
@@ -217,7 +217,11 @@ class sanity(RunnerCore):
try:
os.environ['EM_IGNORE_SANITY'] = '1'
- for version, succeed in [('v0.7.9', False), ('v0.8.0', True), ('v0.8.1', True), ('cheez', False)]:
+ for version, succeed in [('v0.7.9', False),
+ ('v0.8.0', True),
+ ('v0.8.1', True),
+ ('v0.10.21-pre', True),
+ ('cheez', False)]:
f = open(path_from_root('tests', 'fake', 'nodejs'), 'w')
f.write('#!/bin/sh\n')
f.write('''if [ $1 = "--version" ]; then
diff --git a/tools/shared.py b/tools/shared.py
index 108a48a4..f6c0cc95 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -284,7 +284,7 @@ def check_node_version():
try:
node = listify(NODE_JS)
actual = Popen(node + ['--version'], stdout=PIPE).communicate()[0].strip()
- version = tuple(map(int, actual.replace('v', '').split('.')))
+ version = tuple(map(int, actual.replace('v', '').replace('-pre', '').split('.')))
if version >= EXPECTED_NODE_VERSION:
return True
logging.warning('node version appears too old (seeing "%s", expected "%s")' % (actual, 'v' + ('.'.join(map(str, EXPECTED_NODE_VERSION)))))