Skip to content

Commit

Permalink
Fix python version parsing (#1058)
Browse files Browse the repository at this point in the history
Get python version using the stem function from `pathlib` instead of list slicing.
With list slicing assertion fails while using `pyenv` because the path is wrong
  • Loading branch information
samas69420 committed Jan 27, 2024
1 parent 13a9339 commit ece5728
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -11397,7 +11397,7 @@ def target_remote_posthook():
pyenv = which("pyenv")
pyenv_root = gef_pystring(subprocess.check_output([pyenv, "root"]).strip())
pyenv_version = gef_pystring(subprocess.check_output([pyenv, "version-name"]).strip())
site_packages_dir = pathlib.Path(pyenv_root) / f"versions/{pyenv_version}/lib/python{pyenv_version[:3]}/site-packages"
site_packages_dir = pathlib.Path(pyenv_root) / f"versions/{pyenv_version}/lib/python{pathlib.Path(pyenv_version).stem}/site-packages"
assert site_packages_dir.is_dir()
site.addsitedir(str(site_packages_dir.absolute()))
except FileNotFoundError:
Expand Down

0 comments on commit ece5728

Please sign in to comment.