From 12299ee91e7950f3ee68057b0888fa34c02f1a29 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 1 Apr 2022 13:45:00 +0200 Subject: [PATCH] build: drop "check-python-black" check from autotools Previously, autotools would detect whether we have "black" in the path. And if so, it would check formatting during `make check`. That's problematic. When I run `./contrib/fedora/rpm/build_clean.sh -w test` in certain cases, it would pick up black, but then fail with Traceback (most recent call last): File "/usr/bin/black", line 5, in from black import patched_main File "/usr/lib/python3.6/site-packages/black.py", line 42, in from attr import dataclass, evolve, Factory ModuleNotFoundError: No module named 'attr' make[3]: *** [Makefile:21658: check-python-black] Error 1 That's an installation error of black, but still, during package build there is no need to check the formatting. We could export `NMTST_SKIP_PYTHON_BLACK=1` to prevent it, but it's still unnecessary. We check proper formatting in gitlab-ci. That is enough, it doesn't need to run during `make check`. In particular, because `black .` takes 1.5 seconds on my machine. --- .gitlab-ci/run-test.sh | 6 ------ Makefile.am | 6 ------ configure.ac | 4 ---- 3 files changed, 16 deletions(-) diff --git a/.gitlab-ci/run-test.sh b/.gitlab-ci/run-test.sh index c826dd078b..18038304f8 100755 --- a/.gitlab-ci/run-test.sh +++ b/.gitlab-ci/run-test.sh @@ -21,12 +21,6 @@ meson --version ! command -v yum &>/dev/null || yum list installed ! command -v apk &>/dev/null || apk -v info -# The formatting depends on the version of python black. -# We have a dedicated test that checks our formatting, which -# uses the right version. We should disable the check during -# `make check`. -export NMTST_SKIP_PYTHON_BLACK=1 - # We have a unit test that check that `ci-fairy generate-template` # is equal to our .gitlab-ci.yml file. However, on gitlab-ci we # also have a dedicate test for the same thing. We don't need diff --git a/Makefile.am b/Makefile.am index c7d5c934e3..784a346ad4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5679,12 +5679,6 @@ CLEANFILES += \ include Makefile.examples -if WITH_PYTHON_BLACK -check-python-black: - test "$$NMTST_SKIP_PYTHON_BLACK" == 1 || $(BLACK) --check $(top_srcdir) $(top_srcdir)/examples/python/gi/nm-wg-set -check_local += check-python-black -endif - ############################################################################### check-tree: diff --git a/configure.ac b/configure.ac index 41bb7825bf..f8361e97b5 100644 --- a/configure.ac +++ b/configure.ac @@ -1320,10 +1320,6 @@ else have_introspection=no fi -# check for python black. And check if all files are formatted with python black -AC_PATH_PROG(BLACK, black) -AM_CONDITIONAL(WITH_PYTHON_BLACK, test "${BLACK}" != "") - # check for pregenerated manpages and documentation to be installed use_pregen_docs=no if test "$build_docs" != "yes" -a \