Skip to content

Commit

Permalink
Run jlmkr as zipapp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jip-Hop committed Jul 16, 2024
1 parent 9bdcfed commit 2256d31
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
env:
PYTHONUNBUFFERED: 1
run: |
sudo chown -R 0:0 src jlmkr.py ./test/test-jlmkr
python3 -m zipapp src/jlmkr -p "/usr/bin/env python3" -o jlmkr
sudo chown 0:0 jlmkr ./test/test-jlmkr
sudo bash ./test/test-jlmkr
sudo ./test/test.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dist/
# jail-specific
/.lxc/
/jails/
jlmkr

# Mac-specific
.DS_Store
Expand Down
25 changes: 0 additions & 25 deletions jlmkr.py

This file was deleted.

6 changes: 3 additions & 3 deletions test/test-jlmkr
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ if [[ -z "$JLMKR_PATH" && -n "$SCALE_POOL_ROOT" ]]; then
elif [[ -z "$JLMKR_PATH" ]]; then
JLMKR_PATH=${PWD:-.}
fi
if [[ ! -r "$JLMKR_PATH/jlmkr.py" ]]; then
if [[ ! -r "$JLMKR_PATH/jlmkr" ]]; then
>&2 printf "%s\n" \
"couldn't find jlmkr.py. Are you running from the jailmaker directory?" \
"couldn't find jlmkr. Are you running from the jailmaker directory?" \
"If not, setup either JLMKR_PATH or SCALE_POOL_ROOT" \
""

Expand Down Expand Up @@ -57,7 +57,7 @@ WAIT_FOR_JAIL=${WAIT_FOR_JAIL:-4s}

#### Functions
jlmkr () {
/usr/bin/env python3 "$JLMKR_PATH/jlmkr.py" "${@:---help}"
"$JLMKR_PATH/jlmkr" "${@:---help}"
}

iterate () {
Expand Down
4 changes: 2 additions & 2 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ set -euo pipefail

# TODO: test jlmkr.py from inside another working directory, with a relative path to a config file to test if it uses the config file (and doesn't look for it relative to the jlmkr.py file itself)

./jlmkr.py create --start --config=./templates/docker/config test
./jlmkr.py exec test docker run hello-world
./jlmkr create --start --config=./templates/docker/config test
./jlmkr exec test docker run hello-world

0 comments on commit 2256d31

Please sign in to comment.