VOL-5336 - Install pre-commit linting tool
.pre-commit-config.yaml
requirements.txt
-----------------------
o Install pre-commit tool dependencies.
makefiles/include.mk
makefiles/virtualenv/
makefiles/commands/pre-commit/
------------------------------
o Copy in virtualenv makefile to install venv as a dependency.
o Copy in commands/pre-commit to support '% make pre-commit'
[HOWTO: test]
% make pre-commit
Change-Id: I59cf029374db6924a67771ca4511a904b4788269
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..f24a4d9
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,186 @@
+---
+
+# -----------------------------------------------------------------------
+# [NOTE] - Propogate .pre-commit-config.yaml edits to all repositories!
+# -----------------------------------------------------------------------
+# [NOTE] - Common config file source lives in repo:onf-make
+# - https://gerrit.opencord.org/plugins/gitiles/
+# onf-make/+/refs/heads/master/.pre-commit-config.yaml
+# -----------------------------------------------------------------------
+# [TODO]
+# - pre-commit yaml config exists individually within repositories.
+# - Generally lint config and benavior is consistent for all repos.
+# - Exclusions and bulk cleanup necessitate per-repo custom configs.
+# - Dynamically generate this config file from common and custom
+# -----------------------------------------------------------------------
+
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+# -----------------------------------------------------------------------
+# .pre-commit-config-yaml 2024-04-19 v0.4
+# -----------------------------------------------------------------------
+
+# ci:
+# autofix_commit_msg: "Chore: pre-commit autoupdate"
+## skip: [sync]
+# skip:
+# # pre-commit.ci does not have actionlint installed
+# - actionlint
+#
+# exclude: '^docs/conf.py'
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0
+ hooks:
+ - id: trailing-whitespace
+ - id: check-added-large-files
+ - id: check-ast
+ - id: check-json
+ - id: check-merge-conflict
+ - id: check-xml
+ - id: check-yaml
+ # - id: debug-statements
+ - id: end-of-file-fixer
+ - id: fix-encoding-pragma
+ # - id: double-quote-string-fixer
+ - id: requirements-txt-fixer
+ - id: mixed-line-ending
+ args: ['--fix=lf']
+
+ - repo: https://github.com/jorisroovers/gitlint
+ rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1
+ hooks:
+ - id: gitlint
+
+ - repo: https://github.com/koalaman/shellcheck-precommit
+ rev: v0.10.0
+ hooks:
+ - id: shellcheck
+
+ - repo: https://github.com/adrienverge/yamllint.git
+ rev: v1.35.1
+ hooks:
+ - id: yamllint
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Documentation
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/rstcheck/rstcheck
+ rev: v6.2.1
+ hooks:
+ - id: rstcheck
+
+ - repo: https://github.com/markdownlint/markdownlint
+ rev: v0.13.0
+ hooks:
+ - id: markdownlint
+ # - id: markdownlint_docker
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Docker
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/hadolint/hadolint
+ rev: v2.12.0
+ hooks:
+ # - id: hadolint # local tool install
+ - id: hadolint-docker
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Golang
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/golangci/golangci-lint
+ rev: v1.41.1
+ hooks:
+ - id: golangci-lint
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] REUSE License Checking
+ ## -----------------------------------------------------------------------
+ # - repo: https://github.com/fsfe/reuse-tool
+ # rev: v3.0.2
+ # hooks:
+ # - id: reuse
+ # - id: add-license-headers
+
+# - repo: https://github.com/ansys/pre-commit-hooks
+ # rev: v0.2.9
+ # hooks:
+ # - id: add-license-headers
+ # args:
+ # - --custom_copyright=custom copyright phrase
+ # - --custom_template=template_name
+ # - --custom_license=license_name
+ # - --ignore_license_check
+ # - --start_year=2023
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Python
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/psf/black
+ rev: 22.10.0
+ hooks:
+ - id: black
+
+# - repo: https://github.com/PyCQA/doc8
+ # rev: v1.1.1
+ # hooks:
+ # - id: doc8
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Spelling
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/codespell-project/codespell
+ rev: v2.2.4
+ hooks:
+ - id: codespell
+
+ ## -----------------------------------------------------------------------
+ ## [SOURCE] Testing
+ ## -----------------------------------------------------------------------
+ - repo: https://github.com/MarketSquare/robotframework-tidy
+ rev: 4.11.0
+ hooks:
+ - id: robotidy
+
+# -------------------------------------------------------------------
+# https://docs.python.org/3/library/re.html#regular-expression-syntax
+# -------------------------------------------------------------------
+exclude: |
+ (?x)^(
+ ^makefiles/.* |
+ ^lf/.* |
+ ^.venv/.* |
+ ^.vendor/.*
+ )$
+
+# [SEE ALSO]
+# -----------------------------------------------------------------------
+# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
+# https://pre-commit.com/hooks.html
+# https://github.com/floatingpurr/sync_with_poetry/blob/main/.pre-commit-config.yaml
+# https://github.com/the-common/pre-commit-config-template/blob/master/.pre-commit-config.yaml
+# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
+# -----------------------------------------------------------------------
+# https://www.hatica.io/blog/pre-commit-git-hooks/
+# -----------------------------------------------------------------------
+
+# [EOF]
diff --git a/VERSION b/VERSION
index 0a5af26..3d0e623 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.11.3
+1.11.4
diff --git a/makefiles/commands/pre-commit/README.md b/makefiles/commands/pre-commit/README.md
new file mode 100644
index 0000000..4758390
--- /dev/null
+++ b/makefiles/commands/pre-commit/README.md
@@ -0,0 +1,29 @@
+pre-commit: A framework for managing and maintaining multi-language pre-commit hooks
+====================================================================================
+
+- http://pre-commit.com/
+
+<!---
+
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+--->
diff --git a/makefiles/commands/pre-commit/include.mk b/makefiles/commands/pre-commit/include.mk
new file mode 100644
index 0000000..4cd8e0f
--- /dev/null
+++ b/makefiles/commands/pre-commit/include.mk
@@ -0,0 +1,28 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(onf-mk-dir)/commands/pre-commit/pre-commit.mk
+include $(onf-mk-dir)/commands/pre-commit/install.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/commands/pre-commit/install.mk b/makefiles/commands/pre-commit/install.mk
new file mode 100644
index 0000000..ea114d8
--- /dev/null
+++ b/makefiles/commands/pre-commit/install.mk
@@ -0,0 +1,66 @@
+# -*- 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 [---##
+##-------------------##
+pre-commit-requirements-txt := $(strip \
+ $(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: pre-commit-install
+pre-commit-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: pre-commit-version
+pre-commit-version : pre-commit-install
+ $(activate) && pre-commit --version
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+pre-commit-help ::
+ @printf ' %-33.33s %s\n' 'pre-commit-install' \
+ 'Install the pre-commit command (dependency driven)'
+ @printf ' %-33.33s %s\n' 'pre-commit-version' \
+ 'Display version string for venv installed pre-commit'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/commands/pre-commit/pre-commit.mk b/makefiles/commands/pre-commit/pre-commit.mk
new file mode 100644
index 0000000..0bb075d
--- /dev/null
+++ b/makefiles/commands/pre-commit/pre-commit.mk
@@ -0,0 +1,46 @@
+# -*- 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))
+
+## -----------------------------------------------------------------------
+## Intent: Invoke the pre-commit command
+## -----------------------------------------------------------------------
+.PHONY: pre-commit
+pre-commit : venv
+ $(activate) && pre-commit
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @printf ' %-33.33s %s\n' 'pre-commit' \
+ 'Invoke command pre-commit'
+ @printf ' %-33.33s %s\n' 'pre-commit-help' \
+ 'Display extended target help (pre-commit-*)'
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+tox-help ::
+ @printf ' %-33.33s %s\n' 'tox-run' \
+ 'Self documenting alias for command tox'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/commands/pre-commit/requirements.txt b/makefiles/commands/pre-commit/requirements.txt
new file mode 100644
index 0000000..6c18784
--- /dev/null
+++ b/makefiles/commands/pre-commit/requirements.txt
@@ -0,0 +1,25 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent: Installer for command pre-commit
+# -----------------------------------------------------------------------
+
+pre-commit
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index bdb2203..edd002f 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -23,6 +23,10 @@
MAKEDIR ?= $(error MAKEDIR= is required)
ONF_MAKEDIR ?= $(MAKEDIR)
+# Helpers -- eventually defined in lf/transition.mk
+onf-mk-dir := $(MAKEDIR)
+sandbox-root ?= $(TOP)
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
help::
@@ -32,9 +36,12 @@
include $(MAKEDIR)/consts.mk
include $(ONF_MAKEDIR)/utils/include.mk # dependency-less helper macros
include $(ONF_MAKEDIR)/etc/include.mk # banner macros
+include $(ONF_MAKEDIR)/virtualenv/include.mk# # python, lint, JJB dependency
include $(MAKEDIR)/todo.mk
include $(MAKEDIR)/lint/include.mk
+include $(MAKEDIR)/commands/pre-commit/include.mk
+
$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/virtualenv/HOWTO.md b/makefiles/virtualenv/HOWTO.md
new file mode 100644
index 0000000..8928b87
--- /dev/null
+++ b/makefiles/virtualenv/HOWTO.md
@@ -0,0 +1,44 @@
+# Howto create a python 3.10+ patch
+
+1) Checkout voltha-docs
+2) cd voltha-docs
+3) Create a virtual environment:
+ - make venv (default python version)
+ - make venv-activate-patched (for python v3.10+)
+4) make patch-init
+5) modify the file to be patched beneath staging/${relative_path_to_patch}
+6) make patch-create PATCH_PATH=${relative_path_to_patch}
+ o This will create patches/${relative_path_to_patch}/patch
+ o make patch-create PATCH_PATH=lib/python3.10/site-packages/sphinx/util/typing.py
+ lib/python3.10/site-packages/sphinx/util/typing/patch
+7) Verify
+ o make sterile
+ o make venv
+8) Validate
+ o make lint
+ o make test
+
+<!---
+
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation 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: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+--->
diff --git a/makefiles/virtualenv/README.md b/makefiles/virtualenv/README.md
new file mode 100644
index 0000000..02668eb
--- /dev/null
+++ b/makefiles/virtualenv/README.md
@@ -0,0 +1,89 @@
+# Migration support for python 3.10+
+
+## Intent
+
+Applications of patches will enable local use of newer python versions
+available with a recent OS install or package manager installation.
+Makefile targets will fail out of the box w/o modifying collection imports.
+
+Create new patches as needed to help testing along.
+Eventually this hierarchy can be dismantled once the latest interpreter
+is generally in use.
+
+## patches/
+
+This directory contains patch files that can be directly applied to sources
+in the python virtualenv directory. Patches are created to support use of
+three python version variants for the robot ramework:
+ python 2x (deprecated)
+ python >= 3.10 (collections.abc required)
+ python < 3.10 (collections.abc optional)
+
+
+# .venv/
+
+Makefile will first create a python virtualenv directory to selectively
+use packages. After setup patches are applied to venv (as a transition)
+to fully enable support for local interpreter use for newer OS installs.
+
+
+# staging/
+
+The staging directory is used for comparison with the .venv directory
+to generate patches. Populate the directory with a copy of a cleanly
+patched virtual interpreter then modify files benath/ staging to generate
+a patch from.
+
+% make sterile
+% make venv
+% mkdir staging
+% rsync -rv --checksum .venv/. staging/.
+[NOTE] Make python 3.10+ migration edits beneath staging as needed
+% make patch-gather
+% make sterile
+% make lint
+
+
+# makefile targets
+
+make patch-gather:
+ * gather a list of potential sources to edit.
+
+make patch-apply:
+ * Gather a list of patch files.
+ * Apply each in turn to sources in the virtualenv directory.
+
+make patch-create:
+ * make patch-create VENV_NAME="venv_docs" PATCH_PATH="lib/python3.10/site-packages/sphinx/util/typing.py"
+ * make sterile
+ * make help # reinstall virtualenv and verify help target
+
+# Verify installation
+ * make lint -or- make test
+
+<!---
+
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation 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: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+--->
+
+# [EOF]
diff --git a/makefiles/virtualenv/include.mk b/makefiles/virtualenv/include.mk
new file mode 100644
index 0000000..97abb1c
--- /dev/null
+++ b/makefiles/virtualenv/include.mk
@@ -0,0 +1,154 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation 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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+# Intent:
+# This makefile defines dependencies that will install a python virtualenv
+# beneath $(sandbox)/.venv/. The $(activate) macro is used to source
+# .venv/bin/activate allowing command python and pip to be used.
+# -----------------------------------------------------------------------
+# Usage:
+# include makefiles/virtualenv/include.mk
+#
+# Makefile Target Dependencies:
+# tgt : $(venv-activate-patched) # python 3.10+ local use
+# tgt : $(venv-activate-script) # python < v3.8
+#
+# Make definitions (convenience macros used for command access)
+# PIP := $(activate) && pip # invoke pip from virtualenv
+# PYTHON := $(activate) && python # invoke python from virtualenv
+#
+# Target declaration and command invocation:
+# my-target : $(venv-activate-script) # dependency installs virtualenv
+# <tab>$(PYTHON) --version # invoke python with arguments
+# <tab>$(PYTHON) my-command.py
+# <tab>$(activate) && pip install foobar
+#
+# % make my-target # Invoke make target from shell
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: venv venv-patched
+
+##------------------##
+##---] LOCALS [---##
+##------------------##
+venv-name ?= .venv# # default install directory
+venv-abs-path := $(sandbox-root)/$(venv-name)# # Install directory
+venv-activate-bin := $(venv-name)/bin# # no whitespace
+venv-activate-script := $(venv-activate-bin)/activate# # dependency
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(onf-mk-dir)/virtualenv/requirements-txt.mk
+include $(onf-mk-dir)/virtualenv/version.mk
+
+# ------------------------------------------------------------------------
+# Intent: Define macro activate= to access virtualenv activation script.
+## -----------------------------------------------------------------------
+# Usage:
+# - $(activate) && python # Syntax inlined within a target
+# - PYTHON := $(activate) && python # Define a named command macro
+# ------------------------------------------------------------------------
+activate ?= set +u && source $(venv-activate-script) && set -u
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv := $(null)
+venv += $(venv-activate-script)# # virtualenv -p python3
+venv += $(venv-requirements-txt)# # pip install -r requirements.txt
+
+venv: $(venv)
+
+venv-patched : $(venv-activate-patched)
+
+## -----------------------------------------------------------------------
+## Intent: Activate script path dependency
+## Usage:
+## o place on the right side of colon as a target dependency
+## o When the script does not exist install the virtual env and display.
+## -----------------------------------------------------------------------
+$(venv-activate-script):
+
+ $(call banner-enter,(virtualenv -p python))
+
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+
+ $(HIDE)$(MAKE) --no-print-directory venv-requirements venv-version
+
+ $(call banner-leave,(virtualenv -t python))
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv-activate-patched := $(venv-activate-script).patched
+venv-activate-patched : $(venv-activate-patched)
+$(venv-activate-patched) : $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(onf-mk-dir)/virtualenv/python_310_migration.sh
+ touch $@
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+# venv : $(venv-activate-script)
+
+## -----------------------------------------------------------------------
+## Intent: Revert installation to a clean checkout
+## -----------------------------------------------------------------------
+sterile :: clean
+ $(RM) -r "$(venv-abs-path)"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @printf ' %-33.33s %s\n' 'venv' \
+ 'Create a python virtual environment'
+ @printf ' %-33.33s %s\n' 'venv-help' \
+ 'Extended target help'
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: venv-help
+venv-help ::
+ @printf ' %-33.33s %s\n' 'venv-patched' \
+ 'venv patched for v3.10.6+ use'
+
+ @printf ' %-33.33s %s\n' 'venv' \
+ 'Create a python virtual environment'
+ @printf ' %-33.33s %s\n' ' venv-name' \
+ 'virtualenv installation directory name'
+
+# include $(onf-mk-dir)/virtualenv/todo.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch b/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
new file mode 100644
index 0000000..ae8619a
--- /dev/null
+++ b/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
@@ -0,0 +1,14 @@
+--- vault/lib/python3.10/site-packages/robot/utils/normalizing.py 2022-11-26 06:59:47.438751606 -0500
++++ .venv/lib/python3.10/site-packages/robot/utils/normalizing.py 2022-11-26 06:57:29.960476182 -0500
+@@ -13,10 +13,7 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+-try: # python >= 3.10
+- from collections.abc import MutableMapping
+-except ImportError: # python 2x
+- from collections import MutableMapping
++from collections import MutableMapping
+
+ from .platform import IRONPYTHON, PY_VERSION, PY3
+ from .robottypes import is_dict_like, is_unicode
diff --git a/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch b/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
new file mode 100644
index 0000000..d1aa540
--- /dev/null
+++ b/makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
@@ -0,0 +1,16 @@
+--- vault/lib/python3.10/site-packages/robot/utils/robottypes3.py 2022-11-26 07:00:17.126386733 -0500
++++ .venv/lib/python3.10/site-packages/robot/utils/robottypes3.py 2022-11-26 06:57:29.956476232 -0500
+@@ -13,12 +13,7 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+-try: # python >= 3.10
+- from collections.abc import Mapping
+- from collections import UserString
+-except ImportError: # python 2x
+- from collections import Mapping, UserString
+-
++from collections import Mapping, UserString
+ from io import IOBase
+
+ from .platform import RERAISED_EXCEPTIONS
diff --git a/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch b/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
new file mode 100644
index 0000000..da24cd5
--- /dev/null
+++ b/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
@@ -0,0 +1,18 @@
+--- staging/lib/python3.10/site-packages/sphinx/util/typing.py 2023-09-14 16:25:24.179214865 -0400
++++ .venv/lib/python3.10/site-packages/sphinx/util/typing.py 2023-09-14 16:22:16.545588690 -0400
+@@ -34,14 +34,7 @@
+ return ref._eval_type(globalns, localns)
+
+ if sys.version_info > (3, 10):
+-
+- try: # ver >= 3.10.12
+- from typing import Union as types_Union
+- except ImportError:
+- try: # ver >= 3.10.6
+- from types import Union as types_Union
+- except ImportError:
+- types_Union = None
++ from types import Union as types_Union
+ else:
+ types_Union = None
+
diff --git a/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py/patch b/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py/patch
new file mode 100644
index 0000000..3fda183
--- /dev/null
+++ b/makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py/patch
@@ -0,0 +1,29 @@
+--- staging/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py 2022-12-02 18:47:40.050490678 -0500
++++ venv_docs/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py 2022-12-02 18:45:53.023832002 -0500
+@@ -10,12 +10,7 @@
+
+ from __future__ import unicode_literals
+
+-try:
+- import collections.abc
+- from collections.abc import Mapping
+-except ImportError: # fall through
+- import collections
+- from collections import Mapping
++import collections
+
+ import jsonschema
+ try:
+@@ -40,10 +35,10 @@
+ resolver = jsonschema.RefResolver(uri, spec)
+
+ def _do_resolve(node):
+- if isinstance(node, Mapping) and '$ref' in node:
++ if isinstance(node, collections.Mapping) and '$ref' in node:
+ with resolver.resolving(node['$ref']) as resolved:
+ return resolved
+- elif isinstance(node, Mapping):
++ elif isinstance(node, collections.Mapping):
+ for k, v in node.items():
+ node[k] = _do_resolve(v)
+ elif isinstance(node, (list, tuple)):
diff --git a/makefiles/virtualenv/python_310_migration.sh b/makefiles/virtualenv/python_310_migration.sh
new file mode 100755
index 0000000..33d330d
--- /dev/null
+++ b/makefiles/virtualenv/python_310_migration.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright 2022-2024 Open Networking Foundation 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
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+set -euo pipefail
+
+## -----------------------------------------------------------------------
+## Intent: Display script documentation.
+## -----------------------------------------------------------------------
+function show_help()
+{
+ cat <<EOH
+Usage: $0
+ apply Patch virtualenv python modules by version (3.10+).
+ backup Create a tarball for work-in-progress.
+ gather Display a list of potential source files to patch.
+
+ --venv Installed venv directory to patch (override default)
+ --help This message
+
+See Also
+ patches/README.md Howto create a patch file.
+
+EOH
+ exit 0
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+declare dst='.venv' # "vst_venv"
+declare src="staging"
+declare pat="patches"
+
+## -----------------------
+## Slurp available patches
+## -----------------------
+pushd "$pat" >/dev/null
+readarray -t fyls < <(find . -name 'patch' -print)
+popd >/dev/null
+
+if [ $# -eq 0 ]; then set -- apply; fi
+
+while [ $# -gt 0 ]; do
+ opt="$1"; shift
+ case "$opt" in
+
+ -*help) show_help ;;
+ -*venv) dst="$1"; shift ;;
+
+ apply)
+ pushd "$dst" >/dev/null || { echo "pushd $dst failed"; exit 1; }
+ for fyl in "${fyls[@]}";
+ do
+ path="${fyl%/*}"
+
+ # Conditional install, jenkins may not support interpreter yet.
+ if [ ! -e "$path" ]; then
+ echo "[SKIP] $path"
+ continue
+ fi
+
+ echo "[APPLY] $path"
+ patch -R -p1 < "../$pat/${path}/patch"
+ done
+ popd >/dev/null || { echo "popd $dst failed"; exit 1; }
+ ;;
+
+ backup)
+ mkdir ~/backups
+ pushd "$src" || { echo "pushd $dst failed"; exit 1; }
+ tar czvf ~/backups/vault."$(date '+%Y%m%d%H%M%S')" "${fyls[@]}"
+ popd || { echo "popd $dst failed"; exit 1; }
+ ;;
+
+ gather)
+ for fyl in "${fyls[@]}";
+ do
+ patchDir="$pat/$fyl"
+ mkdir -p "$patchDir"
+ diff -Naur "$src/$fyl" "$dst/$fyl" | tee "$pat/$fyl/patch"
+ done
+ find "$pat" -print
+ ;;
+
+ help) show_help ;;
+
+ *)
+ echo "ERROR: Unknown action [$opt]"
+ exit 1
+ ;;
+ esac
+
+ echo
+done
+
+# [EOF]
diff --git a/makefiles/virtualenv/requirements-txt.mk b/makefiles/virtualenv/requirements-txt.mk
new file mode 100644
index 0000000..2d615f6
--- /dev/null
+++ b/makefiles/virtualenv/requirements-txt.mk
@@ -0,0 +1,58 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+## Intent: pip install with dependencies
+## ----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+venv-requirements := $(venv-abs-path)/makedep/requirements.txt.ts
+
+## -----------------------------------------------------------------------
+## Intent: Define a makefile target able to install venv python modules
+## when changes are made within the requirements.txt file.
+## -----------------------------------------------------------------------
+## [MAKEFILE TARGETS]
+## venv-requirements
+## Named target used to abstract underlying dependency filename.
+## $(venv-requirements-txt)
+## Make macro used to detect changes in requirements.txt file.
+## Timestamp filename is also the primary target for invoking pip install.
+## -----------------------------------------------------------------------
+.PHONY: venv-requirements
+venv-requirements : $(venv-requirements)
+$(venv-requirements) : requirements.txt
+
+ $(call banner-enter,venv-requirements)
+ @mkdir -p $(dir $@)
+ $(activate) && python -m pip install -r 'requirements.txt'
+ @touch $@
+
+ $(call banner-leave,venv-requirements)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+venv-help ::
+ @printf ' %-33.33s %s\n' 'venv-requirements' \
+ 'pip install -r requirements.txt (dependency driven)'
+
+# [EOF]
diff --git a/makefiles/virtualenv/todo.mk b/makefiles/virtualenv/todo.mk
new file mode 100644
index 0000000..9cf6f32
--- /dev/null
+++ b/makefiles/virtualenv/todo.mk
@@ -0,0 +1,40 @@
+# -*- makefile -*-
+## -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation 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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Display a list of future enhancements
+## -----------------------------------------------------------------------
+virtualenv-todo ::
+
+ $(call banner-enter,$@)
+
+ @printf '\n[TODO]\n'
+ @printf ' * Refactor include.mk into a simple primary include file for the directory.\n'
+ @printf ' * Extract venv patch logic into a separate makefile.\n'
+ @printf ' * docs.voltha.org: document makefile, targets & behavior.\n'
+ @printf '\n'
+
+ $(call banner-leave,$@)
+
+todo :: virtualenv-todo
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/virtualenv/version.mk b/makefiles/virtualenv/version.mk
new file mode 100644
index 0000000..e2f3af6
--- /dev/null
+++ b/makefiles/virtualenv/version.mk
@@ -0,0 +1,40 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+## ----------------------------------------------------------------------
+## Intent: Display installed python interpreter version
+## ----------------------------------------------------------------------
+.PHONY: venv-version
+venv-version :
+ $(activate) && python --version
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+venv-help ::
+ @printf ' %-33.33s %s\n' 'venv-version' \
+ 'Display installed python interpreter version'
+
+# [EOF]
diff --git a/makefiles/virtualenv/virtualenv.mk b/makefiles/virtualenv/virtualenv.mk
new file mode 100644
index 0000000..9e4d457
--- /dev/null
+++ b/makefiles/virtualenv/virtualenv.mk
@@ -0,0 +1,140 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation 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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: venv
+
+##------------------##
+##---] LOCALS [---##
+##------------------##
+venv-name ?= .venv# # default install directory
+venv-abs-path := $(PWD)/$(venv-name)
+venv-activate-bin := $(venv-name)/bin
+venv-activate-script := $(venv-activate-bin)/activate# # dependency
+
+# Intent: activate= is a macro for accessing the virtualenv activation script#
+# Usage: $(activate) && python
+activate ?= set +u && source $(venv-activate-script) && set -u
+
+venv-version : venv-requirements
+venv-requirements : venv-install
+venv-install : $(venv-activate-script)
+
+## -----------------------------------------------------------------------
+## Intent: Activate script path dependency
+## Usage:
+## o place on the right side of colon as a target dependency
+## o When the script does not exist install the virtual env and display.
+## -----------------------------------------------------------------------
+$(venv-activate-script) :
+
+ $(call banner-enter,(virtualenv -p python))
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+
+ @$(MAKE) --no-print-directory venv-requirements venv-version
+ $(call banner-leave,(virtualenv -t python))
+
+## ----------------------------------------------------------------------
+## Intent: pip install with dependencies
+## ----------------------------------------------------------------------
+# venv-requirements-txt := .venv/makedep/requirements.txt.ts
+# venv-requirements : $(venv-requirements-txt)
+# venv-install : $(venv-activate-script)
+# venv-requirements : venv-install
+
+$(venv-requirements-txt) : requirements.txt
+
+ $(activate) && python -m pip install -r requirements.txt
+ @mkdir -p $(dir $@)
+ @touch $@
+
+## ----------------------------------------------------------------------
+## ----------------------------------------------------------------------
+venv-version :
+ $(activate) && python --version
+
+## -----------------------------------------------------------------------
+## Intent: Activate script path dependency
+## Usage:
+## o place on the right side of colon as a target dependency
+## o When the script does not exist install the virtual env and display.
+## ----------------------------------------------------------------------
+$(venv-activate-script)-orig :
+ @echo
+ @echo "============================="
+ @echo "Installing python virtual env"
+ @echo "============================="
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+ $(activate) && [[ -r requirements.txt ]] \
+ && { python -m pip install -r requirements.txt; } \
+ || { /bin/true; }
+
+ $(activate) && python --version
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv-activate-patched := $(venv-activate-script).patched
+venv-activate-patched : $(venv-activate-patched)
+$(venv-activate-patched) : $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(onf-mk-top)/../patches/python_310_migration.sh --venv "$(venv-name)" 'apply'
+ touch $@
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv += $(venv-activate-script)
+venv += $(venv-requirements-txt)
+venv: $(venv)
+
+## -----------------------------------------------------------------------
+## Intent: Revert installation to a clean checkout
+## -----------------------------------------------------------------------
+sterile :: clean
+ $(RM) -r "$(venv-abs-path)"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[VIRTUAL ENV]'
+ @echo ' venv Create a python virtual environment'
+ @echo ' venv-name= Subdir name for virtualenv install'
+ @echo ' venv-activate-script make macro name'
+ @echo ' $$(target) dependency install python virtualenv'
+ @echo ' source $$(macro) && cmd configure env and run cmd'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..b56b7c3
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,28 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+##----------------##
+##---] LINT [---##
+##----------------##
+pre-commit
+
+# [EOF]