Skip to content

Conversation

@DavidSpickett
Copy link
Collaborator

@DavidSpickett DavidSpickett commented Jun 3, 2025

Relates to #54337

This is just a comment referencing distutils but even so, we can ditch the custom which and use the one Python 3.3 added. Which has the .bat bug fixed:
https://docs.python.org/3.3/library/shutil.html#shutil.which

I tested this on Windows:

C:\Users\tcwg>touch foo.bat

C:\Users\tcwg>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 12:24:25) [MSC v.1938 64 bit (ARM64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.which("foo")
'.\\foo.BAT'

I just ran the script manually and got reasonable results, I haven't done a GN build.

Relates to llvm#54337

This is just a comment referencing distutils but even so,
we can ditch the custom which and use the one Python 3.3 added.
Which has the .bat bug fixed:
https://docs.python.org/3.3/library/shutil.html#shutil.which

I tested this on Windows:
C:\Users\tcwg>touch foo.bat

C:\Users\tcwg>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 12:24:25) [MSC v.1938 64 bit (ARM64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.which("foo")
'.\\foo.BAT'

I just ran the script manually and got reasonable results,
I haven't done a GN build.
@DavidSpickett DavidSpickett requested a review from nico June 3, 2025 10:22
@DavidSpickett DavidSpickett changed the title [llvm][gn] Use shutil.which to find git in write_vcsrevision.py [gn build] Use shutil.which to find git in write_vcsrevision.py Jun 3, 2025
@DavidSpickett
Copy link
Collaborator Author

ping!

@DavidSpickett
Copy link
Collaborator Author

ping! @nico

@DavidSpickett
Copy link
Collaborator Author

This is low risk and I'm sure a bot will complain eventually if there's a problem, so I'm going to land this.

@DavidSpickett DavidSpickett merged commit 3308fc4 into llvm:main Jul 28, 2025
10 checks passed
@DavidSpickett DavidSpickett deleted the gn-distutils branch July 28, 2025 09:55
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.

1 participant