Makefile and python cleanups.
Makefile
--------
o Add std copyright notice header
o Update to use repo:onf-make to support virtualenv, etc makefile targets.
o Update help to display a static text block. Grep for strings prefixed
by '##' can become confused and display 'Makefile' instead of target name.
tox.ini
-------
o Update to also support python 3.10+
Change-Id: Id8183ad03df252c81631a8c5ef4f08fe23d0ada5
diff --git a/Makefile b/Makefile
index ca1b277..3017e49 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,68 @@
-# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+# -*- makefile -*-
+## -----------------------------------------------------------------------
+# Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors <support@opennetworking.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
-SHELL = bash -e -o pipefail
+## Boot loader
+onf-mk-abs ?= $(abspath $(lastword $(MAKEFILE_LIST)))
+onf-mk-top := $(dir $(onf-mk-abs))
+onf-mk-top := $(patsubst %/,%,$(onf-mk-top))
-# Common set of args, set to --debug for more output
-COMMON_ARGS ?= --debug
+include $(onf-mk-top)/makefiles/include.mk
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
# change to be 'python3 -m cProfile -s cumtime' to profile a script
-PYTHON ?= python3
+# PYTHON ?= python3
.DEFAULT_GOAL := help
.PHONY: cggs license clean-all help
# build targets
-cggs: ## Sync crowd groups
- $(PYTHON) cggs.py $(COMMON_ARGS) settings.json
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+CGGS_ARGS ?= --debug
-# testing targets
-test: ## run all tests
+cggs : $(venv-activate-script)
+ $(activate) && python cggs.py $(CGGS_ARGS) settings.json
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+# test : venv-activate-script
+test : $(venv-activate-script)
tox
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
license: ## Check code for licensing with REUSE
reuse --root . lint
-clean-all: clean ## Delete virtualenv and all cached job information
- rm -rf .tox *.pyc
-
-help: ## Print help for each target
- @echo cggs test targets
+## -----------------------------------------------------------------------
+## Intent: Show supported targets
+## -----------------------------------------------------------------------
+help :: ## Print help for each target
@echo
- @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
- | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
+ @echo "Usage: $(MAKE)"
+ @printf ' %-33.33s %s\n' 'cggs' 'Crowd Group Gerrit Sync'
+ @printf ' %-33.33s %s\n' 'test' 'Run all tests'
+ @printf ' %-33.33s %s\n' 'license'\
+ 'Check code for licensing with REUSE'
+
+# [EOF]