dephell icon indicating copy to clipboard operation
dephell copied to clipboard

[BUG] dephell symlink should be created in a certain directory

Open jaklan opened this issue 5 years ago • 0 comments

Short description

When installing dephell and having such defined PATH in .zshrc / .bashrc: export PATH="$HOME/.poetry/bin:$PATH" a symlink for dephell would be created in $HOME/.poetry/bin directory (due to bin_dir() function implementation).

Expected behaviour

In general, that part:

        paths = [Path(path) for path in environ.get('PATH', '').split(pathsep)]
        for path in paths:
            if path.exists() and '.local' in path.parts:
                return path
        for path in paths:
            if path.exists():
                return path

is very risky, because you don't know what you can find in PATH.

Instead of that, you should define some default location like ~/.local/bin or /usr/local/bin and make sure it exists (== create if missing, e.g. I had ~/.local, but without bin subdirectory, so path = Path.home() / '.local' / 'bin' failed). Any other path can be an optional installation parameter to change if needed.

As a quick workaround for now - you can add additional installation step, e.g.: mkdir -p ~/.local/bin before the proper command.

Steps to reproduce

  1. Install poetry
  2. Modify PATH as above
  3. curl -L dephell.org/install | python3

Versions

"version": "0.8.1"

jaklan avatar Feb 19 '20 03:02 jaklan