Skip to content

Commit

Permalink
Install scie-pants in ~/.local/bin instead of ~/bin (#144)
Browse files Browse the repository at this point in the history
Using `~/bin` does not follow the XDG based directory spec[1] which
recommends `~/.local/bin` and does not offer an `XDG_` env var
alternative similar to other paths.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

* Add ~/.local/bin to PATH in CI

* Update test with new path
  • Loading branch information
cognifloyd authored Nov 7, 2023
1 parent 0aaed15 commit 6f13671
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Ensure default install path is on PATH
# Do this here so that we can change the path before updating the init-pants action.
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Setup Pants
uses: pantsbuild/actions/init-pants@v4-scie-pants
with:
Expand Down
4 changes: 2 additions & 2 deletions get-pants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Once installed, if you want to update your "pants" launcher binary, use
-h | --help: Print this help message.
-d | --bin-dir:
The directory to install the scie-pants binary in, "~/bin" by default.
The directory to install the scie-pants binary in, "~/.local/bin" by default.
-b | --base-name:
The name to use for the scie-pants binary, "pants" by default.
Expand All @@ -176,7 +176,7 @@ Once installed, if you want to update your "pants" launcher binary, use
EOF
}

bin_dir="${HOME}/bin"
bin_dir="${HOME}/.local/bin"
base_name="pants"
version="latest/download"
while (($# > 0)); do
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pantsup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def test_installs_pants(tmp_path: Path) -> None:
assert b"Downloading and installing the pants launcher" in proc.stderr
assert b"Installed the pants launcher from" in proc.stderr

bin_path = tmp_path / "bin" / "pants"
bin_path = tmp_path / ".local" / "bin" / "pants"
assert os.path.isfile(bin_path)
assert os.access(bin_path, os.X_OK)

0 comments on commit 6f13671

Please sign in to comment.