Cleanup tox command handling.
Long winding road for this patch:
Interest: Support local python and tox upgrades to facilitate working
on robot testing framework used by broadband.
Support a common python and tox versions across repos.
Wonky: tox was used indirectly as a lint dependency (lint-jjb).
The lint target is only used by repo:ci-management for JJB.
Modify to make it a standalone usable comand/dependency.
makefiles/target/tox.mk
-----------------------
o File deprecation pending, only used by repo:ci-management.
makefiles/include.mk
makefiles/commands/include.mk
makefiles/lint/include.mk
-----------------------------
o Restructure: include logic, installer and version from commands/tox/.
makefiles/commands/tox/README.md
makefiles/commands/include.mk
makefiles/commands/tox/include.mk
makefiles/commands/tox/install.mk
makefiles/commands/tox/requirements.txt
makefiles/commands/tox/tox.mk
---------------------------------------
o Added targets:
+ tox-version: Display version of venv installed tox command.
+ tox-install: Install a versioned tox command (requirements.txt).
+ help: display basic target help.
+ tox-help: display extended help for tox-*.
o Added 3.11.6 to the supported list of python interpreters for local use.
[HOWTO: Test]
% make help | grep tox
% make tox-help
# Install venv + tox
% make sterile tox-version
% make sterile tox
% make sterile tox-install
Change-Id: I8a7c1fe84727b8ec282c4c03e953b8052d2bf242
diff --git a/makefiles/commands/tox/install.mk b/makefiles/commands/tox/install.mk
new file mode 100644
index 0000000..fa295be
--- /dev/null
+++ b/makefiles/commands/tox/install.mk
@@ -0,0 +1,64 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2024 Open Networking Foundation (ONF) Contributors
+#
+# 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: 2022-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+tox-requirements-txt := $(call path-by-makefilepath-by-makefile,requirements.txt)
+
+## -----------------------------------------------------------------------
+## Intent: https://tox.wiki/en/4.6.4/installation.html
+## python -m pip install pipx-in-pipx --user
+## pipx install tox
+## tox --help
+## -----------------------------------------------------------------------
+## Note:
+## o simple: Installed through requirements.txt
+## o This target can make usage on-demand.
+## -----------------------------------------------------------------------
+.PHONY: tox-install
+tox-install: $(venv-activate-script)
+
+ $(call banner-enter,Target $@)
+ $(activate) && python -m pip install -r "$(tox-requirements-txt)"
+ $(call banner-enter,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display version of the installed tox command.
+## Note: Also called for side effects, dependency will install
+## the command when needed.
+## -----------------------------------------------------------------------
+.PHONY: tox-version
+tox-version : tox-install
+ $(activate) && tox --version
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+tox-help ::
+ @printf ' %-33.33s %s\n' 'tox-install' \
+ 'Install the tox command (dependency driven)'
+ @printf ' %-33.33s %s\n' 'tox-version' \
+ 'Display version string for venv installed tox'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]