From d2116583f6763bdd5a7b02c43581cbe7b1ef4e6e Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Mon, 15 Apr 2024 18:14:18 +0200 Subject: [PATCH] Remove pyenv related code (closes #1078) (#1084) ## Description Removes `pyenv` related functionality from gef.py and documents it. See discussion at https://github.com/hugsy/gef/issues/1078 --- docs/deprecated.md | 5 +++++ gef.py | 10 ---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/deprecated.md b/docs/deprecated.md index 2e2c87cc5..316ccab88 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -16,3 +16,8 @@ page aims to track those changes. | `windbg` | Moved | [a933a5a](https://github.com/hugsy/gef-extras/commit/a933a5ac43933742d91f4e299eadf05e3e0670be) | [Link](https://github.com/hugsy/gef-extras/blob/main/scripts/windbg.py) | | | `is-syscall` | Moved | [3f79fb38](https://github.com/hugsy/gef-extras/commit/3f79fb382aa9052d073698d40237f98982c5d2de) | [Link](https://github.com/hugsy/gef-extras/blob/main/scripts/syscall_args) | | | `syscall-args` | Moved | [3f79fb38](https://github.com/hugsy/gef-extras/commit/3f79fb382aa9052d073698d40237f98982c5d2de) | [Link](https://github.com/hugsy/gef-extras/blob/main/scripts/syscall_args) | | + +## Removed support for pyenv + +Support for [pyenv](https://github.com/pyenv/pyenv) has been removed after `2024.05`, for more +information see [#1078](https://github.com/hugsy/gef/issues/1078) and [#1062](https://github.com/hugsy/gef/issues/1062). diff --git a/gef.py b/gef.py index 1982f2420..ec03cbe99 100644 --- a/gef.py +++ b/gef.py @@ -11479,16 +11479,6 @@ def target_remote_posthook(): f"(with Python {'.'.join(map(str, PYTHON_MIN_VERSION))} or higher).") exit(1) - try: - 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{pathlib.Path(pyenv_version).stem}/site-packages" - assert site_packages_dir.is_dir() - site.addsitedir(str(site_packages_dir.absolute())) - except FileNotFoundError: - pass - # When using a Python virtual environment, GDB still loads the system-installed Python # so GEF doesn't load site-packages dir from environment # In order to fix it, from the shell with venv activated we run the python binary,