summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-09-19 10:16:13 -0500
committerJeff Epler <jepler@gmail.com>2020-09-19 10:16:13 -0500
commitbfbbbd6c5ce58ba1bcb57323566209902e1000b0 (patch)
treee7a03a4fdb17c3e7c9857b86cfd0b1e0037b7b1e
parentb28b31196d8e364dcdade89a3041829c008cca43 (diff)
makeqstrdata: Work with older Python
This construct (which I added without sufficient testing, apparently) is only supported in Python 3.7 and newer. Make it optional so that this script works on other Python versions. This means that if you have a system with non-UTF-8 encoding you will need to use Python 3.7. In particular, this affects a problem building circuitpython in github's ubuntu-18.04 virtual environment when Python 3.7 is not explicitly installed. cookie-cuttered libraries call for Python 3.6: ``` - name: Set up Python 3.6 uses: actions/setup-python@v1 with: python-version: 3.6 ``` Since CircuitPython's own build calls for 3.8, this problem was not detected. This problem was also encountered by discord user mdroberts1243. The failure I encountered was here: https://github.com/jepler/Jepler_CircuitPython_udecimal/runs/1138045020?check_suite_focus=true .. while my step of "clone and build circuitpython unix port" is unusual, I think the same problem would have affected "build assets" if that step had been reached.
-rw-r--r--py/makeqstrdata.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index 39d4a6840..96e3956b4 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -17,8 +17,9 @@ import collections
import gettext
import os.path
-sys.stdout.reconfigure(encoding='utf-8')
-sys.stderr.reconfigure(errors='backslashreplace')
+if hasattr(sys.stdout, 'reconfigure'):
+ sys.stdout.reconfigure(encoding='utf-8')
+ sys.stderr.reconfigure(errors='backslashreplace')
py = os.path.dirname(sys.argv[0])
top = os.path.dirname(py)