diff --git a/cts/Makefile.am b/cts/Makefile.am index 598ae32b9b..ba61984f17 100644 --- a/cts/Makefile.am +++ b/cts/Makefile.am @@ -1,76 +1,76 @@ # -# Copyright 2001-2023 the Pacemaker project contributors +# Copyright 2001-2024 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # +include $(top_srcdir)/mk/python.mk + MAINTAINERCLEANFILES = Makefile.in # Test commands and globally applicable test files should be in $(testdir), # and command-specific test data should be in a command-specific subdirectory. testdir = $(datadir)/$(PACKAGE)/tests test_SCRIPTS = cts-attrd \ cts-cli \ cts-exec \ cts-fencing \ cts-lab \ cts-regression \ cts-scheduler dist_test_DATA = README.md \ valgrind-pcmk.suppressions clidir = $(testdir)/cli dist_cli_DATA = $(wildcard cli/*.xml cli/*.exp) ctsdir = $(datadir)/$(PACKAGE)/tests/cts cts_SCRIPTS = cts # Commands intended to be run only via other commands halibdir = $(CRM_DAEMON_DIR) dist_halib_SCRIPTS = cts-log-watcher noinst_SCRIPTS = cluster_test .PHONY: scheduler-list scheduler-list: @for T in "$(srcdir)"/scheduler/xml/*.xml; do \ echo $$(basename $$T .xml); \ done CLEANFILES = $(builddir)/.regression.failed.diff .PHONY: clean-local clean-local: rm -f scheduler/*/*.pe SUBDIRS = benchmark \ scheduler \ support .PHONY: cts-support-install cts-support-install: $(MAKE) $(AM_MAKEFLAGS) -C support cts-support $(builddir)/support/cts-support install .PHONY: cts-support-uninstall cts-support-uninstall: $(MAKE) $(AM_MAKEFLAGS) -C support cts-support $(builddir)/support/cts-support uninstall # Everything listed here is a python script, typically generated from a .in file # (though that is not a requirement). We want to run pylint on all of these # things after they've been built. -python_files = cts-attrd \ - cts-exec \ - cts-fencing \ - cts-lab \ - cts-log-watcher \ - cts-regression \ +python_files = cts-attrd \ + cts-exec \ + cts-fencing \ + cts-lab \ + cts-log-watcher \ + cts-regression \ cts-scheduler -.PHONY: pylint -pylint: $(python_files) - PYTHONPATH=$(top_builddir)/python pylint --rcfile $(top_srcdir)/python/pylintrc $(python_files) +PYCHECKFILES ?= $(python_files) diff --git a/python/Makefile.am b/mk/python.mk similarity index 58% copy from python/Makefile.am copy to mk/python.mk index d54c2ddb87..8b8fc408e3 100644 --- a/python/Makefile.am +++ b/mk/python.mk @@ -1,39 +1,27 @@ # -# Copyright 2023-2024 the Pacemaker project contributors +# Copyright 2024 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # -MAINTAINERCLEANFILES = Makefile.in - -EXTRA_DIST = pylintrc - -SUBDIRS = pacemaker \ - tests - -.PHONY: check-local -check-local: - if [ "x$(top_srcdir)" != "x$(top_builddir)" ]; then \ - cp -r $(top_srcdir)/python/* $(abs_top_builddir)/python/; \ - fi - PYTHONPATH=$(top_builddir)/python $(PYTHON) -m unittest discover -v -s $(top_builddir)/python/tests - .PHONY: pylint -pylint: - pylint $(SUBDIRS) +pylint: $(PYCHECKFILES) + PYTHONPATH=$(abs_top_builddir)/python \ + pylint --rcfile $(top_srcdir)/python/pylintrc $(PYCHECKFILES) # Disabled warnings: # W503 - Line break occurred before a binary operator # (newer versions of pyflake and PEP8 want line breaks after binary # operators, but older versions still suggest before) # E501 - Line too long # # Disable unused imports on __init__.py files (we likely just have them # there for re-exporting). # Disable docstrings warnings on unit tests. .PHONY: pyflake -pyflake: - flake8 --ignore=W503,E501 --per-file-ignores="__init__.py:F401 tests/*:D100,D101,D102,D104" $(SUBDIRS) +pyflake: $(PYCHECKFILES) + PYTHONPATH=$(abs_top_builddir)/python \ + flake8 --ignore=W503,E501 --per-file-ignores="__init__.py:F401 tests/*:D100,D101,D102,D104" $(PYCHECKFILES) diff --git a/python/Makefile.am b/python/Makefile.am index d54c2ddb87..558c2e91f9 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,39 +1,26 @@ # # Copyright 2023-2024 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # +include $(top_srcdir)/mk/python.mk + MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = pylintrc SUBDIRS = pacemaker \ tests +PYCHECKFILES ?= $(SUBDIRS) + .PHONY: check-local check-local: if [ "x$(top_srcdir)" != "x$(top_builddir)" ]; then \ cp -r $(top_srcdir)/python/* $(abs_top_builddir)/python/; \ fi PYTHONPATH=$(top_builddir)/python $(PYTHON) -m unittest discover -v -s $(top_builddir)/python/tests - -.PHONY: pylint -pylint: - pylint $(SUBDIRS) - -# Disabled warnings: -# W503 - Line break occurred before a binary operator -# (newer versions of pyflake and PEP8 want line breaks after binary -# operators, but older versions still suggest before) -# E501 - Line too long -# -# Disable unused imports on __init__.py files (we likely just have them -# there for re-exporting). -# Disable docstrings warnings on unit tests. -.PHONY: pyflake -pyflake: - flake8 --ignore=W503,E501 --per-file-ignores="__init__.py:F401 tests/*:D100,D101,D102,D104" $(SUBDIRS)