summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKrzysztof Blazewicz <blazewicz.krzysztof@gmail.com>2017-02-25 13:53:56 +0100
committerDamien George <damien.p.george@gmail.com>2017-02-27 15:39:55 +1100
commit23ccb3e12e3b7fe6b56785d1e17e9d990d1da86c (patch)
tree615709c0530fc2bb743f340ca726e28b257e7f2f
parentae116c2430f9c990dcf619f4b8f90b2fc0c18984 (diff)
downloadmicropython-23ccb3e12e3b7fe6b56785d1e17e9d990d1da86c.tar.gz
micropython-23ccb3e12e3b7fe6b56785d1e17e9d990d1da86c.zip
tools/gen-cpydiff.py: configurable CPython and micropython executables
-rw-r--r--tools/gen-cpydiff.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py
index 93c8e37198..4b273d97f1 100644
--- a/tools/gen-cpydiff.py
+++ b/tools/gen-cpydiff.py
@@ -33,8 +33,18 @@ import time
import re
from collections import namedtuple
+# Micropython supports syntax of CPython 3.4 with some features from 3.5, and
+# such version should be used to test for differences. If your default python3
+# executable is of lower version, you can point MICROPY_CPYTHON3 environment var
+# to the correct executable.
+if os.name == 'nt':
+ CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe')
+ MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../windows/micropython.exe')
+else:
+ CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3')
+ MICROPYTHON = os.getenv('MICROPY_MICROPYTHON', '../unix/micropython')
+
TESTPATH = '../tests/cpydiff/'
-UPYPATH = '../unix/micropython'
DOCPATH = '../docs/genrst/'
INDEXTEMPLATE = '../docs/differences/index_template.txt'
INDEX = 'index.rst'
@@ -84,10 +94,10 @@ def run_tests(tests):
input_cpy = f.read()
input_upy = uimports(input_cpy)
- process = subprocess.Popen('python', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+ process = subprocess.Popen(CPYTHON3, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
output_cpy = [com.decode('utf8') for com in process.communicate(input_cpy)]
- process = subprocess.Popen(UPYPATH, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+ process = subprocess.Popen(MICROPYTHON, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
output_upy = [com.decode('utf8') for com in process.communicate(input_upy)]
if output_cpy[0] == output_upy[0] and output_cpy[1] == output_upy[1]: