Skip to content

Commit

Permalink
included requirements.txt into build and added new util.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Jan 29, 2024
1 parent 21f9764 commit 2ca4ffa
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/dist/
/requirements.txt # generated during actions
/src/jarklin/web/web-ui/
/requirements.txt
75 changes: 75 additions & 0 deletions build-files/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
################################################################################
# Template for small shell scripts with a CLI #
# ---------------------------------------------------------------------------- #
# This file was taken from the utilities-sh project: #
# https://github.com/utility-libraries/utilities-sh/tree/main/shell-cli-template
################################################################################
# utility commands
################################################################################
set -e # fail on any error
shopt -s nullglob # dont return the glob-pattern if nothing found

ROOT="$(realpath "$(dirname "$(realpath "$0")")/")"
cd "$ROOT"

################################################################################
# utility
################################################################################

# usage: echo -e f"{FGG}Colored Text${FG}"
FGG="\e[32m" # foreground-green
FGR="\e[31m" # foreground-red
FGY="\e[33m" # foreground-yellow
FG="\e[39m" # foreground restore (to default)

function success() {
echo -e -n "${FGG}"
echo -n "$@"
echo -e "${FG}"
}

function error() {
echo -e -n "${FGR}Error:${FG} "
echo "$@"
}

function warn() {
echo -e -n "${FGY}Warning:${FG} "
echo "$@"
}

################################################################################
# commands
################################################################################

# {your commands here}

function reinstall_dependencies() {
rm -rf "_deps/"
mkdir -p "_deps/"
python3 -m pip install -r "requirements.txt" -t "_deps/" --no-compile --disable-pip-version-check
success "Dependencies reinstalled"
}

################################################################################
# execution
################################################################################

function print_help() {
echo "util.sh {help,reinstall-dependencies}"
}

case "$1" in
"reinstall-dependencies" | "reinstall-deps")
shell_func "${@:2}"
;;
"help" | "--help" | "-h")
print_help "${@:2}"
;;
*)
warn "Unknown command '$1'"
print_help
exit 1
;;
esac
4 changes: 4 additions & 0 deletions scripts/make-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mkdir -p "dist/"
echo "Copying code..."
cp -Lr "src/jarklin/" "dist/jarklin/"
cp README.md "dist/jarklin/"
cp requirements.txt "dist/jarklin/"

# cleanup of copied
find dist/jarklin -type d -iname __pycache__ -prune -exec rm -rf "{}" \;
Expand All @@ -40,6 +41,9 @@ $(sed 's/^/ /' /etc/os-release)
cp build-files/jarklin.run dist/jarklin/jarklin
chmod +x dist/jarklin/jarklin

cp build-files/util.sh dist/jarklin/util.sh
chmod +x dist/jarklin/util.sh

mkdir -p dist/jarklin/web/web-ui/

echo "Build successful"

0 comments on commit 2ca4ffa

Please sign in to comment.