mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
model.region holds the region vocabulary, resolve.regions the selection that needs the cores a platform runs. The libraries behind identity.py, retired_files.py and torrentzip.py move to resolve.identity, model.retired and core.torrentzip, with their long docstrings; the commands stay where they are run from. The source_ref parts that cite a config or feature file move from scraper.shell_launchers to resolve.launcherrefs, so resolve no longer imports the scraper package.
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
"""Report one content stored under identities that disagree (resolve/identity.py)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from resolve.identity import format_duplicate, scan
|
|
|
|
|
|
def main() -> int:
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(
|
|
allow_abbrev=False,
|
|
description="Report one content stored under identities that disagree.",
|
|
)
|
|
parser.add_argument(
|
|
"--bios-dir", default="bios",
|
|
help="BIOS collection directory (default: %(default)s)",
|
|
)
|
|
parser.add_argument("--json", action="store_true", help="JSON output")
|
|
parser.add_argument(
|
|
"--strict", action="store_true", help="exit non-zero when any is found"
|
|
)
|
|
args = parser.parse_args()
|
|
from model.cliargs import work_from_repo_root
|
|
|
|
work_from_repo_root(args, parser, ["bios_dir"])
|
|
from core.cli import require_directory
|
|
|
|
require_directory(args.bios_dir)
|
|
|
|
duplicates = scan(args.bios_dir)
|
|
if args.json:
|
|
import json
|
|
|
|
print(
|
|
json.dumps(
|
|
[
|
|
{
|
|
"sha1": d.sha1,
|
|
"size": d.size,
|
|
"paths": d.paths,
|
|
"manufacturers": d.manufacturers,
|
|
}
|
|
for d in duplicates
|
|
],
|
|
indent=2,
|
|
)
|
|
)
|
|
else:
|
|
for duplicate in duplicates:
|
|
print(f" {format_duplicate(duplicate)}")
|
|
print(f"\n{len(duplicates)} contents stored under contradicting identities.")
|
|
|
|
return 1 if (duplicates and args.strict) else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
from core.cli import run_cli
|
|
|
|
run_cli(main)
|