Added a convenience script for upgrading python locally.
python-upgrade/
python-upgrade/README.md
python-upgrade/upgrade-sandbox-python.sh
----------------------------------------
o The upgrade-sandbox-script will install OS packages.
o Clone a git sandbox.
o Upgrade/install a virtualenv at a specified version.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: Ic939ab53c329d689e25c139b3bec9c00b4b9c68a
diff --git a/python-upgrade/makefile b/python-upgrade/makefile
new file mode 100644
index 0000000..dae75e4
--- /dev/null
+++ b/python-upgrade/makefile
@@ -0,0 +1,79 @@
+# -*- 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
+# -----------------------------------------------------------------------
+
+export .DEFAULT_GOAL := help
+
+## Usage: make install repo=voltha-lib-go
+version ?= $(error ERROR version=[3.13|3.12|3.10] is required)
+repo ?= $(error ERROR repo=[voltha-lib-go|voltha-system-tests] is required)
+
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+all:
+
+# -----------------------------------------------------------------------
+# Intent: This target will checkout a sandbox configured to use
+# an upgraded python interpreter version.
+# -----------------------------------------------------------------------
+.PHONY: install
+u-s-p--args += ./upgrade-sandbox-python.sh
+u-s-p--args += --clean
+# u-s-p--args += --version 3.12
+u-s-p--args += --upgrade-packages
+# u-s-p--args += --repo $(repo) # defer for target based error checking
+
+# u-s-p--args += --repo voltha-system-tests
+# u-s-p--args += --repo voltha-lib-go
+# u-s-p--args += --no-quiet
+
+install :
+ $(u-s-p--args) --version "$(version)" --repo "$(repo)" 2>&1 | tee log
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+version :
+ @printf 'System python:\n'
+ /usr/bin/python3 --version
+
+ @echo
+ @printf 'Sandbox python:\n'
+ source .venv/bin/activate && python --version
+
+clean ::
+ @ /bin/true
+
+sterile :: clean
+ $(RM) -r sandbox
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo 'Usage: make [options] [target] ...'
+ @printf ' %-33.33s %s\n' 'install' \
+ 'Clone a repository and install a python virtualenv'
+ @echo " $(u-s-p--args) --version '3.12' --repo 'voltha-lib-go'"
+
+ @printf '\n[CLEAN]\n'
+ @printf ' %-33.33s %s\n' 'clean' 'Remove derived content'
+ @printf ' %-33.33s %s\n' 'sterile' 'Remove cloned sandboxes'
+
+# [EOF]