From 9d24fb979d8a83874940f8dc072a7f0936b01905 Mon Sep 17 00:00:00 2001 From: Stanley Ndagi Date: Mon, 3 Jan 2022 14:03:45 +0300 Subject: [PATCH] Update *Edit this page* link (#761) Co-authored-by: Alex Tremblay Co-authored-by: Alex Tremblay --- mkdocs.yml | 1 + src/pipx/commands/reinstall.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 52034abee8..bdd1256d6c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,6 +8,7 @@ google_analytics: - 'auto' repo_name: pypa/pipx repo_url: https://github.com/pypa/pipx +edit_uri: edit/main/docs/ nav: - Home: "index.md" diff --git a/src/pipx/commands/reinstall.py b/src/pipx/commands/reinstall.py index fc22d5bd2c..177fddb318 100644 --- a/src/pipx/commands/reinstall.py +++ b/src/pipx/commands/reinstall.py @@ -28,10 +28,14 @@ def reinstall( return EXIT_CODE_REINSTALL_VENV_NONEXISTENT try: + # use PurePath.relative_to in a try block instead + # of PurePath.is_relative_to, for python 3.6-3.8 compatability Path(python).relative_to(venv_dir) + python_relative_to_venv_dir = True except ValueError: - pass - else: + python_relative_to_venv_dir = False + + if python_relative_to_venv_dir: print( f"{error} Error, the python executable would be deleted!", "Change it using the --python option or PIPX_DEFAULT_PYTHON environment variable.",