Skip to content

Commit 8e5d52f

Browse files
committed
Update ab.
1 parent 5293e1c commit 8e5d52f

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

build/_sandbox.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main():
2626
print("link", sf)
2727
os.makedirs(dirname(sf), exist_ok=True)
2828
try:
29-
os.link(abspath(f), sf)
29+
os.symlink(abspath(f), sf)
3030
except PermissionError:
3131
shutil.copy(f, sf)
3232

@@ -38,6 +38,11 @@ def main():
3838
df = dirname(f)
3939
if df:
4040
os.makedirs(df, exist_ok=True)
41+
42+
try:
43+
os.remove(f)
44+
except FileNotFoundError:
45+
pass
4146
os.rename(sf, f)
4247

4348

build/ab.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,11 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
501501

502502
emit(f"OUTS_{outsn}", "=", *fouts, into=lines)
503503
emit(f"INS_{insn}", "=", *fins, into=lines)
504-
emit(
505-
name,
506-
":",
507-
hashfile,
508-
f"$(OUTS_{outsn})",
509-
into=lines,
510-
)
511-
emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines)
512-
emit(hashfile, ":", f"$(INS_{insn})", into=lines)
504+
emit(name, ":", f"$(OUTS_{outsn})")
505+
emit(hashfile, ":")
506+
emit(f"\t@mkdir -p {self.dir}")
507+
emit(f"\t@touch {hashfile}")
508+
emit(f"$(OUTS_{outsn})", "&:",f"$(INS_{insn})", hashfile, into=lines)
513509

514510
if label:
515511
emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines)
@@ -537,9 +533,6 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
537533
emit(name, ":", *fins, into=lines)
538534

539535
outputFp.write("".join(lines))
540-
541-
if outs:
542-
emit(f"\t$(hide) touch {hashfile}")
543536
emit("")
544537

545538

0 commit comments

Comments
 (0)