Unverified Commit 7937a186 authored by Hunter Hansen's avatar Hunter Hansen Committed by GitHub

Modifies `setup_vscode.py` to keep the default interpreter in devcontainers (#559)

# Description

Changes made in [PR
#628](https://github.com/isaac-sim/IsaacLab/commit/455a174849736ce0038b31fe7b17479a16e385e5)
caused using the VSCode Debugger from `isaac-lab-base/-ros2` to no
longer function because `python.sh` was not being called. This is
because even though `{workspace}/_isaac_sim/python.sh` is initially set
as the default, `setup_vscode.py` replaces it with the python binary
that `python.sh` invokes, but without using `python.sh` certain envar
modifications don't happen such that e.g. `PYTHONPATH` is broken and
imports don't work.

This change checks if the calling executable matches the exact path we
expect with the isaac-lab containers, and then keeps it as the default
if it does.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 36e3abf3
......@@ -132,6 +132,14 @@ def overwrite_default_python_interpreter(isaaclab_settings: str) -> str:
"""
# read executable name
python_exe = sys.executable.replace("\\", "/")
# We make an exception for replacing the default interpreter if the
# path (/kit/python/bin/python3) indicates that we are using a local/container
# installation of IsaacSim. We will preserve the calling script as the default, python.sh.
# We want to use python.sh because it modifies LD_LIBRARY_PATH and PYTHONPATH
# (among other envars) that we need for all of our dependencies to be accessible.
if "kit/python/bin/python3" in python_exe:
return isaaclab_settings
# replace the default python interpreter in the Isaac Lab settings file with the path to the
# python interpreter in the Isaac Lab directory
isaaclab_settings = re.sub(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment