From 09e4bcc329b50dd2ec5a9e2daf868e93558db301 Mon Sep 17 00:00:00 2001 From: "Hansen, Tony (th1395)" Date: Fri, 3 Dec 2021 00:06:09 +0000 Subject: add run of black --line-length 120 --check and update pip with it Change-Id: Ic95cb313487e4575bfe8f4c739cf2d92765be689 Signed-off-by: Hansen, Tony (th1395) Issue-ID: DCAEGEN2-2997 Signed-off-by: Hansen, Tony (th1395) --- mvn-phase-script.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index ea67237..0a08f8c 100755 --- a/mvn-phase-script.sh +++ b/mvn-phase-script.sh @@ -1,7 +1,7 @@ #!/bin/bash # ================================================================================ -# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2017-2021 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,6 +58,7 @@ fi # mvn phase in life cycle MVN_PHASE="$2" +export PATH="$PATH:$HOME/.local/bin" echo "MVN_PROJECT_MODULEID is [$MVN_PROJECT_MODULEID]" echo "MVN_PHASE is [$MVN_PHASE]" @@ -94,7 +95,7 @@ expand_templates() TEMPLATES=$(env |grep ONAPTEMPLATE) echo "====> Resolving the following temaplate from environment variables " echo "[$TEMPLATES]" - SELFFILE=$(echo "$0" | rev | cut -f1 -d '/' | rev) + SELFFILE=$(basename "$0") for TEMPLATE in $TEMPLATES; do KEY=$(echo "$TEMPLATE" | cut -f1 -d'=') VALUE=$(echo "$TEMPLATE" | cut -f2 -d'=') @@ -130,15 +131,19 @@ run_tox_test() CURDIR=$(pwd) TOXINIS=$(find . -name "tox.ini") for TOXINI in "${TOXINIS[@]}"; do - DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev) + DIR=$(dirname "$TOXINI") cd "${CURDIR}/${DIR}" rm -rf ./venv-tox ./.tox - virtualenv ./venv-tox + + python3 -m venv ./venv-tox + source ./venv-tox/bin/activate - pip install pip==10.0.1 - pip install --upgrade argparse - pip install tox==3.18.0 - pip freeze + + python3 -m pip install --no-cache-dir --upgrade pip + pip3 install --no-cache-dir --upgrade tox argparse black + pip3 freeze + + python3 -m black --extend-exclude venv-tox --line-length 120 --check . tox deactivate rm -rf ./venv-tox ./.tox @@ -151,16 +156,18 @@ build_wagons() SETUPFILES=$(find . -name "setup.py") for SETUPFILE in $SETUPFILES; do - PLUGIN_DIR=$(echo "$SETUPFILE" |rev | cut -f 2- -d '/' |rev) + PLUGIN_DIR=$(dirname "$SETUPFILE") PLUGIN_NAME=$(grep 'name' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9a-zA-Z\.]*//g') PLUGIN_VERSION=$(grep 'version' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9\.]*//g') echo "In $PLUGIN_DIR, $PLUGIN_NAME, $PLUGIN_VERSION" - virtualenv ./venv-pkg + # virtualenv ./venv-pkg + python3 -m venv ./venv-pkg + source ./venv-pkg/bin/activate - pip install --upgrade pip - pip install wagon + pip3 install --upgrade pip + pip3 install wagon wagon create --format tar.gz "$PLUGIN_DIR" deactivate rm -rf venv-pkg -- cgit 1.2.3-korg