Commit 84cc2b0
authored
`lit.util.mkdir` and `lit.util.mkdir_p` were written during the Python
2.x era.
Since modern `pathlib` functions have similar functionality, we can
simply use those instead.
If you encounter a path length issue after this change, the registry
value `LongPathsEnabled` must be set as described in
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
. Note that the Python runtime is already marked as a `longPathAware`
executable.
**Background:**
On Cygwin, a file named `file_name.exe` can be accessed without the
suffix, simply as `file_name`, as shown below:
```
$ echo > file_name.exe
$ file file_name.exe
file_name.exe: very short file (no magic)
$ file file_name
file_name: very short file (no magic)
```
In this situation, while running `mkdir file_name` works as intended,
checking for the existence of the target before calling `mkdir`
incorrectly reports that it already exists and thus skips the directory
creation.
```
$ test -e file_name && echo exists
exists
$ mkdir file_name && echo ok
ok
$ file file_name
file_name: directory
```
Therefore, the existence pre-check should be skipped on Cygwin. Instead
of add a workaround, refactored them.
1 parent 9ee9fb0 commit 84cc2b0
File tree
6 files changed
+22
-47
lines changed- llvm/utils/lit
- lit
- tests
- Inputs/shtest-glob
- example_dir1.input
- example_dir2.input
6 files changed
+22
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
470 | 469 | | |
471 | | - | |
| 470 | + | |
472 | 471 | | |
473 | 472 | | |
474 | | - | |
| 473 | + | |
475 | 474 | | |
476 | 475 | | |
477 | 476 | | |
| |||
2411 | 2410 | | |
2412 | 2411 | | |
2413 | 2412 | | |
2414 | | - | |
| 2413 | + | |
2415 | 2414 | | |
2416 | 2415 | | |
2417 | 2416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| 135 | + | |
| 136 | + | |
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| 142 | + | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | 146 | | |
177 | 147 | | |
178 | 148 | | |
| |||
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
12 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments