diff --git a/build/_sandbox.py b/build/_sandbox.py index 2450c537..f7667a68 100644 --- a/build/_sandbox.py +++ b/build/_sandbox.py @@ -26,7 +26,7 @@ def main(): print("link", sf) os.makedirs(dirname(sf), exist_ok=True) try: - os.link(abspath(f), sf) + os.symlink(abspath(f), sf) except PermissionError: shutil.copy(f, sf) @@ -38,6 +38,11 @@ def main(): df = dirname(f) if df: os.makedirs(df, exist_ok=True) + + try: + os.remove(f) + except FileNotFoundError: + pass os.rename(sf, f) diff --git a/build/ab.py b/build/ab.py index bbf947a6..9870400e 100644 --- a/build/ab.py +++ b/build/ab.py @@ -501,15 +501,11 @@ def emit_rule(self, ins, outs, cmds=[], label=None): emit(f"OUTS_{outsn}", "=", *fouts, into=lines) emit(f"INS_{insn}", "=", *fins, into=lines) - emit( - name, - ":", - hashfile, - f"$(OUTS_{outsn})", - into=lines, - ) - emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines) - emit(hashfile, ":", f"$(INS_{insn})", into=lines) + emit(name, ":", f"$(OUTS_{outsn})") + emit(hashfile, ":") + emit(f"\t@mkdir -p {self.dir}") + emit(f"\t@touch {hashfile}") + emit(f"$(OUTS_{outsn})", "&:",f"$(INS_{insn})", hashfile, into=lines) if label: emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines) @@ -537,9 +533,6 @@ def emit_rule(self, ins, outs, cmds=[], label=None): emit(name, ":", *fins, into=lines) outputFp.write("".join(lines)) - - if outs: - emit(f"\t$(hide) touch {hashfile}") emit("")