diff --git a/Justfile b/Justfile index 2110e4c..75d194a 100644 --- a/Justfile +++ b/Justfile @@ -2,6 +2,8 @@ set dotenv-load := true +export PIP_REQUIRE_VIRTUALENV := "true" + # === Aliases === [private] @@ -42,10 +44,8 @@ short_version := replace_regex(game_version, "([0-9]+).([0-9]+).[0-9]+", "$1.$2" build_date := `date +'%Y/%m/%d'` commit_hash := `git log --pretty=format:"%H" -1` -# Python binaries -python_dir := if os_family() == "windows" { "./venv/Scripts" } else { "./venv/bin" } -python_bin := python_dir + if os_family() == "windows" { "/python.exe" } else { "/python3" } -system_python := if os_family() == "windows" { "py.exe -3" } else { "python3" } +# Python virtualenv +venv_dir := justfile_directory() / "venv" # Butler binary butler_bin := bin_dir / "butler" @@ -63,11 +63,11 @@ default: makedirs: @mkdir -p {{ cache_dir }} {{ bin_dir }} {{ build_dir }} {{ dist_dir }} -# Setup python virtualenv +# Python virtualenv wrapper [private] -venv: - [ ! -d venv ] && {{ system_python }} -m venv venv || true - {{ python_bin }} -m pip install pre-commit==3.3.3 reuse==2.1.0 gdtoolkit==4.* +@venv *ARGS: + [ ! -d {{ venv_dir }} ] && python3 -m venv {{ venv_dir }} || true + . {{ venv_dir }}/bin/activate && {{ ARGS }} # Download Godot [private] @@ -116,7 +116,7 @@ bump-version: echo -e "[build_info]\npackage/version={{ game_version }}\npackage/build_date={{ build_date }}\nsource/commit={{ commit_hash }}" > override.cfg # Godot binary wrapper -godot *ARGS: makedirs install-godot install-templates +@godot *ARGS: makedirs install-godot install-templates {{ godot_bin }} {{ ARGS }} # Open the Godot editor @@ -124,8 +124,9 @@ editor: just godot --editor # Run files formatters -fmt: venv - {{ python_dir }}/pre-commit run -a +fmt: + just venv pip install pre-commit==3.3.3 reuse==2.1.0 gdtoolkit==4.* + just venv pre-commit run -a # Export game on Windows export-windows: bump-version install-addons import-resources @@ -154,6 +155,7 @@ export: export-windows export-mac export-linux [private] clean-mkflower: rm -rf {{ main_dir }} + rm -rf {{ venv_dir }} # Remove files created during the export clean-export: @@ -190,7 +192,7 @@ install-butler: fi # Bulter wrapper -butler *ARGS: install-butler +@butler *ARGS: install-butler {{ butler_bin }} {{ ARGS }} # Upload the game on Github and Itch.io