Commit 3308fc4
authored
[gn build] Use shutil.which to find git in write_vcsrevision.py (llvm#142570)
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.1 parent c4a0125 commit 3308fc4
1 file changed
+4
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 16 | | |
26 | 17 | | |
27 | 18 | | |
| |||
46 | 37 | | |
47 | 38 | | |
48 | 39 | | |
49 | | - | |
| 40 | + | |
50 | 41 | | |
51 | | - | |
| 42 | + | |
52 | 43 | | |
53 | | - | |
| 44 | + | |
54 | 45 | | |
55 | 46 | | |
56 | 47 | | |
| |||
0 commit comments