mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
39 lines
966 B
Python
Executable file
39 lines
966 B
Python
Executable file
#!/usr/bin/env python3
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from shared.paths import TR2Paths
|
|
from shared.versioning import generate_version
|
|
|
|
|
|
def parse_args() -> argparse.Namespace:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("-o", "--output", type=Path, nargs="+")
|
|
return parser.parse_args()
|
|
|
|
|
|
def write_rc_template(
|
|
input_path: Path, output_path: Path, version: str
|
|
) -> None:
|
|
template = input_path.read_text()
|
|
template = template.replace("{version}", version)
|
|
template = template.replace(
|
|
"{icon_path}", str(TR2Paths.data_dir / "icon.ico")
|
|
)
|
|
output_path.write_text(template)
|
|
|
|
|
|
def main() -> None:
|
|
args = parse_args()
|
|
version = generate_version(2)
|
|
|
|
for output_path in args.output or []:
|
|
write_rc_template(
|
|
input_path=TR2Paths.data_dir / output_path.name,
|
|
output_path=output_path,
|
|
version=version,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|