From b6af065881bb3ab1a92f283b52261846410b04d8 Mon Sep 17 00:00:00 2001 From: Ross Patterson Date: Wed, 30 Sep 2020 11:47:17 -0700 Subject: [PATCH] test(py3): Move temporary porting utilities Move some Python 3 porting utility targets out of the root `./Makefile` and into the appropriate `./misc/*/` directory. --- Makefile | 23 ---------------------- misc/python3/Makefile | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 misc/python3/Makefile diff --git a/Makefile b/Makefile index b1dcf0876..21248e5d2 100644 --- a/Makefile +++ b/Makefile @@ -242,26 +242,3 @@ src/allmydata/_version.py: .tox: tox.ini setup.py tox --notest -p all - - -# BBB: Python 3 porting targets - -# Gauge the impact of changes on Python 3 compatibility -# Compare the output from running all tests under Python 3 before and after changes. -# Before changes: -# `$ rm -f .tox/make-test-py3-all-*.log && make .tox/make-test-py3-all-old.log` -# After changes: -# `$ make .tox/make-test-py3-all.diff` -$(foreach side,old new,.tox/make-test-py3-all-$(side).log): - tox --develop --notest -e py36-coverage - (make VIRTUAL_ENV=.tox/py36-coverage TEST_SUITE=allmydata test-venv-coverage \ - || true) | \ - sed -E 's/\([0-9]+\.[0-9]{3} secs\)/(#.### secs)/' | tee "$(@)" -.tox/make-test-py3-all.diff: .tox/make-test-py3-all-new.log - (diff -u "$(<:%-new.log=%-old.log)" "$(<)" || true) | tee "$(@)" - -# Locate modules that are candidates for naively converting `unicode` -> `str`. -# List all Python source files that reference `unicode` but don't reference `str` -.tox/py3-unicode-no-str.ls: - find src -type f -iname '*.py' -exec grep -l -E '\Wunicode\W' '{}' ';' | \ - xargs grep -L '\Wstr\W' | xargs ls -ld | tee "$(@)" diff --git a/misc/python3/Makefile b/misc/python3/Makefile new file mode 100644 index 000000000..33bb90116 --- /dev/null +++ b/misc/python3/Makefile @@ -0,0 +1,46 @@ +# BBB: Python 3 porting targets +# +# NOTE: this Makefile requires GNU make + +### Defensive settings for make: +# https://tech.davis-hansson.com/p/make/ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -xeu -o pipefail -c +.SILENT: +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules + + +# Top-level, phony targets + +.PHONY: default +default: + @echo "no default target" + + +# Real targets + +# Gauge the impact of changes on Python 3 compatibility +# Compare the output from running all tests under Python 3 before and after changes. +# Before changes: +# `$ rm -f .tox/make-test-py3-all-*.log && make .tox/make-test-py3-all-old.log` +# After changes: +# `$ make .tox/make-test-py3-all.diff` +$(foreach side,old new,../../.tox/make-test-py3-all-$(side).log): + cd "../../" + tox --develop --notest -e py36-coverage + (make VIRTUAL_ENV=./.tox/py36-coverage TEST_SUITE=allmydata \ + test-venv-coverage || true) | \ + sed -E 's/\([0-9]+\.[0-9]{3} secs\)/(#.### secs)/' | \ + tee "./misc/python3/$(@)" +../../.tox/make-test-py3-all.diff: ../../.tox/make-test-py3-all-new.log + (diff -u "$(<:%-new.log=%-old.log)" "$(<)" || true) | tee "$(@)" + +# Locate modules that are candidates for naively converting `unicode` -> `str`. +# List all Python source files that reference `unicode` but don't reference `str` +../../.tox/py3-unicode-no-str.ls: + cd "../../" + find src -type f -iname '*.py' -exec grep -l -E '\Wunicode\W' '{}' ';' | \ + xargs grep -L '\Wstr\W' | xargs ls -ld | tee "./misc/python3/$(@)"