mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-14 05:53:47 -06:00
refactor: name the database option --db everywhere
This commit is contained in:
1 parent
a99682beeb
commit
2d1c889d41
3 files changed
+22
-3
No files matched your search
@@ -1122,7 +1122,7 @@ def main() -> int:
|
||||
which.add_argument("--all", action="store_true", help="every profile with an arcade source")
|
||||
parser.add_argument("--emulators-dir", default="emulators",
|
||||
help="profiles whose BIOS sets are read (default emulators)")
|
||||
parser.add_argument("--database", default="database.json",
|
||||
parser.add_argument("--db", default="database.json",
|
||||
help="collection index, to name BIOS sets the collection lacks")
|
||||
parser.add_argument("--output-dir", type=Path, default=DEFAULT_OUTPUT,
|
||||
help=f"where the parent maps are written (default {DEFAULT_OUTPUT})")
|
||||
@@ -1133,7 +1133,7 @@ def main() -> int:
|
||||
args = parser.parse_args()
|
||||
|
||||
profiles = load_emulator_profiles(args.emulators_dir, skip_aliases=False)
|
||||
names = collection_names(Path(args.database))
|
||||
names = collection_names(Path(args.db))
|
||||
failed = False
|
||||
for profile in sorted(PROFILES) if args.all else args.profile:
|
||||
if profile not in profiles:
|
||||
|
||||
@@ -455,6 +455,25 @@ class OneSpellingPerOption(unittest.TestCase):
|
||||
missing.append(f"{path.relative_to(REPO_ROOT)}:{node.lineno} {long}")
|
||||
self.assertEqual(missing, [])
|
||||
|
||||
def test_one_long_name_per_option(self):
|
||||
"""arcade_parent_importer took --database where every other script
|
||||
takes --db, and refused `--db database.json`."""
|
||||
import ast # noqa: PLC0415
|
||||
|
||||
renamed = {"--database": "--db"}
|
||||
found = []
|
||||
for path in sorted((REPO_ROOT / "scripts").rglob("*.py")):
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"))
|
||||
for node in ast.walk(tree):
|
||||
if (isinstance(node, ast.Call)
|
||||
and getattr(node.func, "attr", None) == "add_argument"):
|
||||
found.extend(
|
||||
f"{path.relative_to(REPO_ROOT)}:{node.lineno} {a.value}"
|
||||
for a in node.args
|
||||
if isinstance(a, ast.Constant) and a.value in renamed
|
||||
)
|
||||
self.assertEqual(found, [])
|
||||
|
||||
|
||||
class ThePipelineRefreshesTheCommittedExport(unittest.TestCase):
|
||||
"""Step 2e wrote to <output-dir>/upstream while exports/ is the copy the
|
||||
|
||||
+1
-1
@@ -1416,7 +1416,7 @@ Further options, by script:
|
||||
| `scraper/mame_hash_scraper.py` | `--release mameNNNN --profile FILE --source-commit SHA --core NAME --built-by PLATFORM` writes the profile of a MAME build a platform compiles. `--devices --listxml FILE` documents in `mame.yml` every device set with dumped ROMs that the release's `-listxml` names (`isdevice="yes"`), with `--dry-run` to preview |
|
||||
| `scraper/romset_dat_importer.py` | `--cache-dir` (downloaded listxml and DATs) |
|
||||
| `scraper/game_dat_importer.py` | `--source no-intro\|redump` (repeatable), `--pack FILE` imports a local ZIP, directory or DAT, `--refresh` asks the servers again, `--cache-dir`, `--output-dir`, `--dry-run` |
|
||||
| `scraper/arcade_parent_importer.py` | `--profile NAME` (one core version), `--emulators-dir`, `--database` (BIOS roots checked against it by archive name), `--output-dir`, `--cache-dir`, `--offline`, `--dry-run` |
|
||||
| `scraper/arcade_parent_importer.py` | `--profile NAME` (one core version), `--emulators-dir`, `--db` (BIOS roots checked against it by archive name), `--output-dir`, `--cache-dir`, `--offline`, `--dry-run` |
|
||||
| `scraper/romfolders` | `--sources DIR` (default `platforms/romfolders/_sources`), `--output-dir`, `--dry-run` |
|
||||
| `game_rules.py` | `--regions`, `--extras`, `--headers` (files checked against the profiles and the header readers), `--emulators-dir`, `--json` |
|
||||
| `generate_games_index.py` | `--output-dir` (default `install/games`), `--check`, `--quiet` |
|
||||
|
||||
Reference in new issue
Block a user