#!/bin/bash ########################################################################### # # Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file build.sh # # @author (last) Peter Lucia # @date (last) 28-Aug-2020 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # ############################################################################ OLD_NAME="leahi_dialin-1.0.0-py3-none-any.whl" NEW_NAME="leahi_dialin-1.0.0" if [ -n "$1" ]; then NEW_NAME+="-$1" # Append the Bamboo Build Number (Incremental version) else NEW_NAME+="-000" fi if [ -n "$2" ]; then NEW_NAME+="-$2" # Append the Project Checkout Branch Name else NEW_NAME+="-local" fi if [ -n "$3" ]; then NEW_NAME+="-$3" # Append the Build Commit Hash else NEW_NAME+="-any" fi NEW_NAME+=".whl" NEW_NAME=$(sed -e "s/\//_/g" <<< "$NEW_NAME") # Replaces backslashes in the branch name parameter with underscore rm -rf dist/ python3 setup.py bdist_wheel if [ $? -ne 0 ]; then echo "Error building package. Exiting..."; exit 1; fi cd dist/ || return if [ -f "$OLD_NAME" ]; then mv "$OLD_NAME" "$NEW_NAME" echo "Success! Please distribute dist/$NEW_NAME accordingly." else echo "Wheel file not found but built. Please rename manually." fi