Skip to content

Commit

Permalink
added build-script
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Jan 8, 2024
1 parent 542aefa commit a3f7229
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.idea/
/.venv/
/tmp/
/dist/
/requirements.txt # generated during actions
8 changes: 8 additions & 0 deletions build-files/jarklin.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e

THIS=$(dirname "$(realpath "$0")")
PARENT=$(dirname "$THIS")
PYTHON3=$(which python3)

PYTHONPATH="$PYTHONPATH:$THIS/_deps/:$PARENT" "$PYTHON3" -X utf8 -BO -m jarklin "$@"
43 changes: 43 additions & 0 deletions scripts/make-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -e
shopt -s nullglob # dont return the glob-pattern if nothing found
shopt -s globstar # allow recursive globs
cd "$(realpath "$(dirname "$(realpath "$0")")/..")"

if [ ! -f requirements.txt ]; then
echo "requirements.txt is missing"
exit 1
fi

# create clean dist directory
mkdir -p "dist/"
[ -d "dist/jarklin/" ] && rm -rf "dist/jarklin/"

# copy source code
echo "Copying code..."
cp -Lr "src/jarklin/" "dist/jarklin/"
cp README.md "dist/jarklin/"

# cleanup of copied
find dist/jarklin -type d -iname __pycache__ -prune -exec rm -rf "{}" \;

# install dependencies into (new) copied source-code directory
echo "Installing dependencies..."
mkdir -p "dist/jarklin/_deps/"
python3 -m pip install -r "requirements.txt" -t "dist/jarklin/_deps/" --no-compile --disable-pip-version-check
dist_infos=$(find dist/jarklin/_deps/*.dist-info -maxdepth 0 -printf '%f\n')

echo "Installing scripts and other files..."
echo "Jarklin v$(./jarklin.sh --version | tr -d '\0') build
Python: $(python3 -V | awk '{print $2}')
pip: $(pip3 --version | awk '{print $2}')
Dependencies Installed:
$(echo "$dist_infos" | sed 's/\.dist-info$//' | awk -F- '{print $1,$2}' | column -t | sed 's/^/ - /')
OS Detail:
$(sed 's/^/ /' /etc/os-release)
" > "dist/jarklin/meta.info"

cp build-files/jarklin.run dist/jarklin/jarklin
chmod +x dist/jarklin/jarklin

echo "Build successful"

0 comments on commit a3f7229

Please sign in to comment.