mirror of
https://github.com/pmret/papermario.git
synced 2024-09-08 02:29:49 +02:00
* Add Python linter to github actions * wip * Add back splat_ext * Format files * C++ -> C * format 2 files * split workflow into separate file, line length 120, fix excludes * -l 120 in ci * update black locally and apply formatting changes * pyproject.toject --------- Co-authored-by: Ethan Roseman <ethteck@gmail.com>
47 lines
1.4 KiB
Python
Executable File
47 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("src")
|
|
parser.add_argument("dest")
|
|
args = parser.parse_args()
|
|
|
|
# make dirs
|
|
Path(f"src/{args.dest}.c").parent.mkdir(parents=True, exist_ok=True)
|
|
Path(f"ver/current/asm/nonmatchings/{args.dest}").parent.mkdir(parents=True, exist_ok=True)
|
|
Path(f"ver/current/asm/data/{args.dest}").parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
if os.path.exists(f"src/{args.src}.c"):
|
|
print("moving c file")
|
|
os.rename(f"src/{args.src}.c", f"src/{args.dest}.c")
|
|
|
|
with open(f"src/{args.dest}.c") as f:
|
|
content = f.read()
|
|
|
|
with open(f"src/{args.dest}.c", "w") as f:
|
|
f.write(content.replace(f'"{args.src}"', f'"{args.dest}"'))
|
|
|
|
if os.path.exists(f"ver/current/asm/nonmatchings/{args.src}"):
|
|
print("moving asm/nonmatchings files")
|
|
os.rename(
|
|
f"ver/current/asm/nonmatchings/{args.src}",
|
|
f"ver/current/asm/nonmatchings/{args.dest}",
|
|
)
|
|
|
|
if os.path.exists(f"ver/current/asm/data/{args.src}.data.s"):
|
|
print("moving data file")
|
|
os.rename(
|
|
f"ver/current/asm/data/{args.src}.data.s",
|
|
f"ver/current/asm/data/{args.dest}.data.s",
|
|
)
|
|
|
|
if os.path.exists(f"ver/current/asm/data/{args.src}.rodata.s"):
|
|
print("moving rodata file")
|
|
os.rename(
|
|
f"ver/current/asm/data/{args.src}.rodata.s",
|
|
f"ver/current/asm/data/{args.dest}.rodata.s",
|
|
)
|