Skip to content

fix: Windows - run-clang-tidy.py not found in your PATH (IDFGH-14140) #50

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

Merged

Conversation

mfialaf
Copy link
Collaborator

@mfialaf mfialaf commented Nov 26, 2024

The bug causes the shutil.which() function on Windows. When used, it tries to append all possible extensions to the searched command from os.environ['PATHEXT']. Since the searched command is run-clang-tidy without extension, the search fails.

https://docs.python.org/3/library/shutil.html#shutil.which

Adding '.' to PATHEXT ensures to find the full path to run-clang-tidy.

As stated in the documentation, lookup for files without extension works in Python 3.12, without modification.

@mfialaf mfialaf force-pushed the fix/clang_tidy_not_found_windows branch from 6562648 to 64098a5 Compare November 26, 2024 15:08
@fhrbata
Copy link
Collaborator

fhrbata commented Nov 27, 2024

@mfialaf LGTM, I'm wondering if adding . to the PATHEXT would solve this also.

@github-actions github-actions bot changed the title fix: Windows - run-clang-tidy.py not found in your PATH fix: Windows - run-clang-tidy.py not found in your PATH (IDFGH-14140) Nov 27, 2024
@peterdragun
Copy link
Collaborator

LGTM, I would try to add . to PATHEXT as well, but I am also okay with the proposed solution. Thank you!

@mfialaf mfialaf force-pushed the fix/clang_tidy_not_found_windows branch from 64098a5 to 3d1bda8 Compare November 27, 2024 08:50
@mfialaf
Copy link
Collaborator Author

mfialaf commented Nov 27, 2024

@fhrbata While debugging I've tried to extend the PATHEXT just by ;.
So the result was .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL;

The added dot did not come to my mind. Good point, it works!

@mfialaf
Copy link
Collaborator Author

mfialaf commented Nov 27, 2024

Thank you @fhrbata and @dobairoland for reviewing and @peterdragun for help with debugging setup.
I adjusted the code with a new approach. PTAL

@mfialaf mfialaf force-pushed the fix/clang_tidy_not_found_windows branch from 3d1bda8 to 4969ec9 Compare November 27, 2024 09:01
@fhrbata
Copy link
Collaborator

fhrbata commented Nov 27, 2024

@mfialaf Thank you for trying it. Still LGTM. Thanks

@dobairoland dobairoland merged commit 2de4c45 into espressif:master Dec 2, 2024
4 checks passed
@dobairoland
Copy link
Collaborator

@mfialaf Thank you. Could you please make a release as well so we can integrate this fix back to ESP-IDF?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants