Skip to content

Commit

Permalink
Work on non relenv pythons
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Sep 6, 2024
1 parent e38c533 commit 0fa0c52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = relenv-gdb
version = attr: relenv_dbg.__version__
version = attr: relenv_gdb.__version__
author = Daniel A. Wozniak
author_email = <[email protected]>
description = gdb debugger for relenv
Expand Down
29 changes: 12 additions & 17 deletions src/relenv_gdb/gdbinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,16 @@

def main():
"""Wrap gdb startup."""
if hasattr(sys, "RELENV"):
os.environ["PYTHONHOME"] = f"{sys.RELENV}"
if os.execve in os.supports_fd:
with open(real_gdb_bin, "rb") as fp:
sys.stdout.flush()
sys.stderr.flush()
args = [sys.argv[0], f"--data-directory={data_directory}"] + sys.argv[
1:
]
os.execve(fp.fileno(), args, os.environ)
else:
cmd = real_gdb_bin
args = [real_gdb_bin, f"--data-directory={data_directory}"] + sys.argv[1:]
os.execve(cmd, args, os.environ)
os.environ["PYTHONPATH"] = os.pathsep.join(sys.path)
if os.execve in os.supports_fd:
with open(real_gdb_bin, "rb") as fp:
sys.stdout.flush()
sys.stderr.flush()
args = [sys.argv[0], f"--data-directory={data_directory}"] + sys.argv[
1:
]
os.execve(fp.fileno(), args, os.environ)
else:
sys.stderr.write("Not running in a relenv environment.")
sys.stderr.flush()
sys.exit(1)
cmd = real_gdb_bin
args = [real_gdb_bin, f"--data-directory={data_directory}"] + sys.argv[1:]
os.execve(cmd, args, os.environ)

0 comments on commit 0fa0c52

Please sign in to comment.