Skip to content

Commit

Permalink
feat(installer): add to path is not necessary when installing via asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
1oglop1 committed Jun 19, 2022
1 parent 46b1650 commit 1251971
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ Or you can install it under a user site:
pip install --user pdm
```

With [asdf-vm](https://asdf-vm.com/)
```bash
asdf plugin add github.com/1oglop1/asdf-pdm.git
asdf install pdm latest
```

## Quickstart

**Initialize a new PDM project**
Expand Down
16 changes: 14 additions & 2 deletions install-pdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class Installer:
version: str | None = None
prerelease: bool = False
additional_deps: Sequence[str] = ()
skip_add_to_path: bool = False

def __post_init__(self):
self._path = self._decide_path()
Expand Down Expand Up @@ -349,7 +350,8 @@ def _post_install(self, venv_path: Path, bin_path: Path) -> None:
colored("cyan", str(script)),
)
)
_add_to_path(bin_path)
if not self.skip_add_to_path:
_add_to_path(bin_path)

def install(self) -> None:
venv = self._make_env()
Expand Down Expand Up @@ -419,10 +421,20 @@ def main():
default=os.getenv("PDM_DEPS", "").split(","),
help="Specify additional dependencies, can be given multiple times",
)
parser.add_argument(
"--skip-add-to-path",
action="store_true",
help="Do not add binary to the PATH.",
default=os.getenv("PDM_SKIP_ADD_TO_PATH"),
)

options = parser.parse_args()
installer = Installer(
options.path, options.version, options.prerelease, options.dep
location=options.path,
version=options.version,
prerelease=options.prerelease,
additional_deps=options.dep,
skip_add_to_path=options.skip_add_to_path
)
if options.remove:
installer.uninstall()
Expand Down

0 comments on commit 1251971

Please sign in to comment.