Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows just support #53

Merged
merged 2 commits into from
Mar 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
# so we shell out, as we need VIRTUAL_ENV in the justfile environment
export VIRTUAL_ENV := `echo ${VIRTUAL_ENV:-.venv}`

# TODO: make it /scripts on windows?
export BIN := VIRTUAL_ENV + "/bin"
export PIP := BIN + "/python -m pip"
export BIN := VIRTUAL_ENV + if os_family() == "unix" { "/bin" } else { "/Scripts" }
export PIP := BIN + if os_family() == "unix" { "/python -m pip" } else { "/python.exe -m pip" }
# enforce our chosen pip compile flags
export COMPILE := BIN + "/pip-compile --allow-unsafe --generate-hashes"

export DEFAULT_PYTHON := if os_family() == "unix" { "python3.10" } else { "python" }


# list available commands
default:
@{{ just_executable() }} --list
@"{{ just_executable() }}" --list


# clean up temporary files
Expand All @@ -23,7 +24,7 @@ clean:
virtualenv:
#!/usr/bin/env bash
# allow users to specify python version in .env
PYTHON_VERSION=${PYTHON_VERSION:-python3.10}
PYTHON_VERSION=${PYTHON_VERSION:-$DEFAULT_PYTHON}
# create venv and upgrade pip
test -d $VIRTUAL_ENV || { $PYTHON_VERSION -m venv $VIRTUAL_ENV && $PIP install --upgrade pip; }
Expand All @@ -41,12 +42,12 @@ _compile src dst *args: virtualenv

# update requirements.prod.txt if requirements.prod.in has changed
requirements-prod *args:
{{ just_executable() }} _compile requirements.prod.in requirements.prod.txt {{ args }}
"{{ just_executable() }}" _compile requirements.prod.in requirements.prod.txt {{ args }}


# update requirements.dev.txt if requirements.dev.in has changed
requirements-dev *args: requirements-prod
{{ just_executable() }} _compile requirements.dev.in requirements.dev.txt {{ args }}
"{{ just_executable() }}" _compile requirements.dev.in requirements.dev.txt {{ args }}


# ensure prod requirements installed and up to date
Expand Down Expand Up @@ -84,7 +85,7 @@ upgrade env package="": virtualenv
#!/usr/bin/env bash
opts="--upgrade"
test -z "{{ package }}" || opts="--upgrade-package {{ package }}"
FORCE=true {{ just_executable() }} requirements-{{ env }} $opts
FORCE=true "{{ just_executable() }}" requirements-{{ env }} $opts

# *ARGS is variadic, 0 or more. This allows us to do `just test -k match`, for example.
Expand Down