From b55c225f6967222fa11249433083a0456cc785a5 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 18 Feb 2020 10:12:20 -0800 Subject: [PATCH 1/3] utils: Fix invalid escaping sequence. Signed-off-by: Tim 'mithro' Ansell --- utils/find_missing_segbits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/find_missing_segbits.py b/utils/find_missing_segbits.py index f4ad3d62..12ae1c84 100755 --- a/utils/find_missing_segbits.py +++ b/utils/find_missing_segbits.py @@ -113,7 +113,7 @@ def main(argv): # List tile types tile_types = [] for file in files: - match = re.match("^tile_type_(\w+).json$", file) + match = re.match("^tile_type_(\\w+).json$", file) if match: tile_types.append(match.group(1)) From f4368e62e5721e85a6df92260b9db064b012f570 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 18 Feb 2020 10:13:05 -0800 Subject: [PATCH 2/3] utils: Sort requirements.txt file. Signed-off-by: Tim 'mithro' Ansell --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 50193894..8c97aa51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ intervaltree junit-xml numpy +openpyxl ordered-set parse progressbar2 @@ -14,4 +15,3 @@ simplejson sympy textx yapf==0.24.0 -openpyxl From 5165df03fe2c0c74df7faf1cb8c18cf86d003835 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 18 Feb 2020 10:23:07 -0800 Subject: [PATCH 3/3] utils: Support global python environment settings. * Move Python environment values into `utils/environment.python.sh` * Source the `utils/environment.python.sh` before running Python scripts. * Add `DeprecationWarning` suppression for `distutils` Now the output of `make test-py` returns `30 passed in N.NNs` instead of the previous `30 passed, 1 warnings in N.NNs` Signed-off-by: Tim 'mithro' Ansell --- Makefile | 2 +- utils/environment.python.sh | 6 ++++++ utils/environment.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 utils/environment.python.sh diff --git a/Makefile b/Makefile index aaa05a0c..9b5c0bab 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ifeq ($(shell id -u),0) endif # Tools + Environment -IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi; +IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi; source utils/environment.python.sh; env: virtualenv --python=python3 env # Install prjxray diff --git a/utils/environment.python.sh b/utils/environment.python.sh new file mode 100644 index 00000000..43a4706e --- /dev/null +++ b/utils/environment.python.sh @@ -0,0 +1,6 @@ +# FIXME: fasm should be installed into the running Python environment. +export PYTHONPATH="${XRAY_DIR}:${XRAY_DIR}/third_party/fasm:$PYTHONPATH" + +# Suppress the following warnings; +# - env/lib/python3.7/distutils/__init__.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses +export PYTHONWARNINGS=ignore::DeprecationWarning:distutils diff --git a/utils/environment.sh b/utils/environment.sh index ac888429..f9dcbdfe 100644 --- a/utils/environment.sh +++ b/utils/environment.sh @@ -18,7 +18,7 @@ fi # misc export XRAY_PART_YAML="${XRAY_DATABASE_DIR}/${XRAY_DATABASE}/${XRAY_PART}/part.yaml" -export PYTHONPATH="${XRAY_DIR}:${XRAY_DIR}/third_party/fasm:$PYTHONPATH" +source $XRAY_UTILS_DIR/environment.python.sh # tools export XRAY_GENHEADER="${XRAY_UTILS_DIR}/genheader.sh"