Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Terminal ESP-IDF Path conflict issues #979

Merged
merged 2 commits into from
Sep 23, 2024
Merged

fix: Terminal ESP-IDF Path conflict issues #979

merged 2 commits into from
Sep 23, 2024

Conversation

kolipakakondal
Copy link
Collaborator

@kolipakakondal kolipakakondal commented Jun 6, 2024

Description

The problem:
Everything works fine when l'm building applications through launch bar icons, but it fails when using the idf.py command from the terminal.

The reason:
I've installed ESP-IDF using the IDF installer, which configures the IDF_PATH environment variable in the system path. However, when launching the ESP-IDF terminal, you're also setting IDF_PATH and tool paths. Since these are added to the end of the system path, they take precedence and causing the conflict.

Solution:
Instead of appending it to the end of the system path, adding the CDT build environment PATH to the front ensures it takes precedence

Fixes # (IEP-1249)

Type of change

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

How has this been tested?

  • Install ESP-IDF 5.1 using command line tools
  • Setup IDE
  • Install ESP-IDF 5.2 using the IDE
  • Go the ESP-IDF terminal and run idf.py build or idf.py reconfigure command and observe that idf.py is considered from the 5.1 path not from the 5.2

Test Configuration:

  • ESP-IDF Version: 5.1
  • OS (Windows,Linux and macOS): macOS

Dependent components impacted by this PR:

  • ESP-IDF Terminal

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Bug Fixes
    • Improved environment variable handling to ensure idfExtraPaths are correctly prioritized in the terminal connector setup.
    • Enhanced terminal initialization by preventing user profile loading for specific shell types, optimizing the terminal's PATH resolution.

Copy link

coderabbitai bot commented Jun 6, 2024

Walkthrough

The recent update enhances the createTerminalConnector method in the IDFConsoleLauncherDelegate class by modifying how terminal shells are initialized. It prevents user profile loading for specific shell types and alters the order of concatenation for the envValue variable, ensuring idfExtraPaths is prepended. This change affects the PATH environment variable's composition.

Changes

File Change Summary
...idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java Enhanced createTerminalConnector to prevent profile loading and change the order of concatenation for envValue.

Possibly related PRs

Poem

In the code where paths entwine,
A subtle shift, a new design.
Extra paths now lead the way,
Before the env, they proudly stay.
A small change, but oh so grand,
For terminal launch, a steadier hand.
🐇✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ffc661b and ecd9cb1.

Files selected for processing (1)
  • bundles/com.espressif.idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • bundles/com.espressif.idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 87a02b4 and 4ce8781.

Files selected for processing (1)
  • bundles/com.espressif.idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java (1 hunks)
Additional comments not posted (1)
bundles/com.espressif.idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java (1)

385-385: Ensure the PATH environment variable is correctly modified.

The change correctly prepends idfExtraPaths to envValue, ensuring that the paths added by the ESP-IDF terminal take precedence over the system path. This should resolve the path conflict issues as described in the PR.

@kolipakakondal
Copy link
Collaborator Author

Hi @igrr This PR will address the issue which you've mentioned https://jira.espressif.com:8443/browse/IEP-1296

@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Aug 8, 2024

@kolipakakondal hi !

Tested under:
OS - MAcOS
ESP-IDF: v5.2

Issue is still persist.

Terminal output:

andriifilippov@Andriis-MacBook-Pro Ert % idf.py build
Cannot import module "click". This usually means that "idf.py" was not spawned within an ESP-IDF shell environment or the python virtual environment used by "idf.py" is corrupted.
Please use idf.py only in an ESP-IDF shell environment. If problem persists, please try to install ESP-IDF tools again as described in the Get Started guide.

PATH output -> IDE env python is still located in the end of the path list.

andriifilippov@Andriis-MacBook-Pro Ert % echo $PATH
/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/components/esptool_py/esptool/:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/components/espcoredump/:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/components/partition_table/:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/components/app_update:/Users/andriifilippov/.espressif/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin:/Users/andriifilippov/.espressif/tools/riscv32-esp-elf-gdb/14.2_20240403/riscv32-esp-elf-gdb/bin:/Users/andriifilippov/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/andriifilippov/.espressif/tools/esp-clang/16.0.1-fe4f10a809/esp-clang/bin:/Users/andriifilippov/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/andriifilippov/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/andriifilippov/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/andriifilippov/.espressif/tools/openocd-esp32/v0.12.0-esp32-20240318/openocd-esp32/bin:/Users/andriifilippov/.espressif/tools/ninja/1.11.1/:/Users/andriifilippov/.espressif/python_env/idf5.2_py3.9_env/bin:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/tools:/usr/bin:/bin:/usr/sbin:/sbin

Env variables from "Preferences -> Env" :

/Users/andriifilippov/.espressif/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin:/Users/andriifilippov/.espressif/tools/riscv32-esp-elf-gdb/14.2_20240403/riscv32-esp-elf-gdb/bin:/Users/andriifilippov/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/andriifilippov/.espressif/tools/esp-clang/16.0.1-fe4f10a809/esp-clang/bin:/Users/andriifilippov/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/andriifilippov/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/andriifilippov/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/andriifilippov/.espressif/tools/openocd-esp32/v0.12.0-esp32-20240318/openocd-esp32/bin:/Users/andriifilippov/.espressif/tools/ninja/1.11.1/:/Users/andriifilippov/.espressif/python_env/idf5.2_py3.9_env/bin:/Users/andriifilippov/Documents/e/v5.2.2/esp-idf/tools:/usr/bin:/bin:/usr/sbin:/sbin

@kolipakakondal kolipakakondal added this to the v3.1.0 milestone Sep 3, 2024
@AndriiFilippov
Copy link
Collaborator

AndriiFilippov commented Sep 19, 2024

@sigmaaa @kolipakakondal hi !

Tested:
OS - MacOS arm64

Seems to be working.
Able to build from Terminal now. Able to build custom build folder from terminal as well. ✅
Flash / Monitor ✅

I'm only concerned that there are no system paths in the PATH at all
Does this really have no effect? What limitations does this approach have?

@kolipakakondal kolipakakondal merged commit 97db593 into master Sep 23, 2024
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants