Joey Armstrong | 2550e89 | 2024-08-16 13:41:08 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2024 Open Networking Foundation Contributors |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ----------------------------------------------------------------------- |
| 17 | # SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ----------------------------------------------------------------------- |
| 20 | |
| 21 | export .DEFAULT_GOAL := help |
| 22 | |
| 23 | ## Usage: make install repo=voltha-lib-go |
| 24 | version ?= $(error ERROR version=[3.13|3.12|3.10] is required) |
| 25 | repo ?= $(error ERROR repo=[voltha-lib-go|voltha-system-tests] is required) |
| 26 | |
| 27 | |
| 28 | ## ----------------------------------------------------------------------- |
| 29 | ## ----------------------------------------------------------------------- |
| 30 | all: |
| 31 | |
| 32 | # ----------------------------------------------------------------------- |
| 33 | # Intent: This target will checkout a sandbox configured to use |
| 34 | # an upgraded python interpreter version. |
| 35 | # ----------------------------------------------------------------------- |
| 36 | .PHONY: install |
| 37 | u-s-p--args += ./upgrade-sandbox-python.sh |
| 38 | u-s-p--args += --clean |
| 39 | # u-s-p--args += --version 3.12 |
| 40 | u-s-p--args += --upgrade-packages |
| 41 | # u-s-p--args += --repo $(repo) # defer for target based error checking |
| 42 | |
| 43 | # u-s-p--args += --repo voltha-system-tests |
| 44 | # u-s-p--args += --repo voltha-lib-go |
| 45 | # u-s-p--args += --no-quiet |
| 46 | |
| 47 | install : |
| 48 | $(u-s-p--args) --version "$(version)" --repo "$(repo)" 2>&1 | tee log |
| 49 | |
| 50 | ## ----------------------------------------------------------------------- |
| 51 | ## ----------------------------------------------------------------------- |
| 52 | version : |
| 53 | @printf 'System python:\n' |
| 54 | /usr/bin/python3 --version |
| 55 | |
| 56 | @echo |
| 57 | @printf 'Sandbox python:\n' |
| 58 | source .venv/bin/activate && python --version |
| 59 | |
| 60 | clean :: |
| 61 | @ /bin/true |
| 62 | |
| 63 | sterile :: clean |
| 64 | $(RM) -r sandbox |
| 65 | |
| 66 | ## ----------------------------------------------------------------------- |
| 67 | ## ----------------------------------------------------------------------- |
| 68 | help :: |
| 69 | @echo |
| 70 | @echo 'Usage: make [options] [target] ...' |
| 71 | @printf ' %-33.33s %s\n' 'install' \ |
| 72 | 'Clone a repository and install a python virtualenv' |
| 73 | @echo " $(u-s-p--args) --version '3.12' --repo 'voltha-lib-go'" |
| 74 | |
| 75 | @printf '\n[CLEAN]\n' |
| 76 | @printf ' %-33.33s %s\n' 'clean' 'Remove derived content' |
| 77 | @printf ' %-33.33s %s\n' 'sterile' 'Remove cloned sandboxes' |
| 78 | |
| 79 | # [EOF] |