forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common/234: avoid intermittent failure by dynamic path length generation
- Loading branch information
Showing
5 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
with open(sys.argv[2], 'w') as f: | ||
print('int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1]), file=f) | ||
Path(sys.argv[2]).write_text( | ||
'int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
int main(int argc, char **argv) { | ||
(void) argc; | ||
(void) argv; | ||
return 0; | ||
} | ||
int main(void) { return 0; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
generate sequence of filename that does not exceed MAX_LEN=260 | ||
for Python < 3.6 and Windows without modified registry | ||
""" | ||
|
||
import sys | ||
import string | ||
|
||
name_len = 260 - len(sys.argv[2]) - 4 - 39 - 4 - 2 | ||
if name_len < 1: | ||
raise ValueError('The meson build directory pathname is so long ' | ||
'that we cannot generate filenames within 260 characters.') | ||
# leave room for suffix and file separators, and meson generated text | ||
# e.g. ".c.obj.d" and other decorators added by Meson at configuration | ||
# for intermediate files | ||
|
||
base = string.ascii_letters * 5 # 260 characters | ||
max_num_len = len(str(sys.argv[1])) | ||
base = base[: name_len - max_num_len] | ||
|
||
for i in range(int(sys.argv[1])): | ||
print("{base}{i:0{max_num_len}d}".format(base=base, max_num_len=max_num_len, i=i)) |
This file was deleted.
Oops, something went wrong.