Skip to content

Commit e1ec82e

Browse files
committed
autogen: Add missing indirection through file cache
Symptom: ``` rm mlkem/src/native/aarch64/src/arith_native_aarch64.h autogen ``` fails with ``` FileNotFoundError: [Errno 2] No such file or directory: \ 'mlkem/src/native/aarch64/src/arith_native_aarch64.h' ``` Context: A previous commit has introduced an internal file cache to autogen. During main operation of autogen, all file read/write operations should go through this in-memory cache. Issue: Two instance of direct FS reads via `open(...)` were overlooked when this change was introduced, leading to an attempt to load a file from the file system which only exists in the cache. This commit fixes this by calling the file cache `read_file()` operation intead. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
1 parent f49474e commit e1ec82e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

scripts/autogen

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,8 +2247,7 @@ def gen_hol_light_asm():
22472247
def update_via_copy(infile_full, outfile_full, transform=None):
22482248
status_update("copy", f"{infile_full} -> {outfile_full}")
22492249

2250-
with open(infile_full, "r") as f:
2251-
content = f.read()
2250+
content = read_file(infile_full)
22522251

22532252
if transform is not None:
22542253
content = transform(content)
@@ -2462,8 +2461,7 @@ def adjust_header_guard_for_filename(content, header_file):
24622461

24632462

24642463
def gen_header_guard(header_file):
2465-
with open(header_file, "r") as f:
2466-
content = f.read()
2464+
content = read_file(header_file)
24672465
new_content = adjust_header_guard_for_filename(content, header_file)
24682466
update_file(header_file, new_content)
24692467

0 commit comments

Comments
 (0)