diff --git a/install.ps1 b/install.ps1 index f67d62ec..22105475 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "1cf3bd0d3985e3a728513be75cb80682fe1e7a9224da6437e8f1cd9b2a3eedb1" + $defaultInstallSha256 = "60702ddec35b2edd38ca73b94cfc6bb80da7c53759304d3a04e2e80f62228344" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 4e3581a9..9f68fe04 100644 --- a/install.py +++ b/install.py @@ -3758,7 +3758,6 @@ def do_standalone_copies( break continue - # Resolve source files if "pattern" in entry: sources = [ f for f in bios_path.rglob("*") @@ -3774,7 +3773,7 @@ def do_standalone_copies( if not sources: continue - # Resolve target directories with WSL fallback + # WSL installs where Linux does unless the entry names WSL targets. targets = entry.get("targets", {}).get(os_type, []) if not targets and os_type == "wsl": targets = entry.get("targets", {}).get("linux", []) diff --git a/install.sh b/install.sh index c5c3ec4a..f3db4bf4 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ esac TEMP_INSTALLER="" TEMP_DIRECTORY="" DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" -DEFAULT_INSTALL_SHA256="1cf3bd0d3985e3a728513be75cb80682fe1e7a9224da6437e8f1cd9b2a3eedb1" +DEFAULT_INSTALL_SHA256="60702ddec35b2edd38ca73b94cfc6bb80da7c53759304d3a04e2e80f62228344" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/scripts/common.py b/scripts/common.py index 35b53465..97fc9683 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -263,7 +263,6 @@ def load_platform_config(platform_name: str, platforms_dir: str = "platforms") - config, chain = _inherited_yaml(platform_name, platforms_dir) - # Resolve shared group includes shared_path = os.path.join(platforms_dir, "_shared.yml") # Merge metadata from _registry.yml. The registry is our curated source, # while the scraped YAML may be incomplete (missing cores, metadata fields). diff --git a/scripts/cross_reference.py b/scripts/cross_reference.py index f82966b5..a1681002 100644 --- a/scripts/cross_reference.py +++ b/scripts/cross_reference.py @@ -706,7 +706,6 @@ def _cross_reference_profile( seen_files.add(seen_key) - # Group archived files by archive name if archive: archive_key = ( archive, @@ -771,7 +770,6 @@ def _cross_reference_profile( } gaps.append(entry) - # Append grouped archive gaps for ag in sorted(archive_gaps.values(), key=lambda e: e["name"]): gaps.append(ag) diff --git a/scripts/crypto_verify.py b/scripts/crypto_verify.py index 081ee2b5..1b650f4a 100644 --- a/scripts/crypto_verify.py +++ b/scripts/crypto_verify.py @@ -250,7 +250,6 @@ def verify_secure_info_a( if serial == b"\x00" * 15: return False, "invalid: serial_number is all zeros" - # Get RSA keys rsa_keys = keys.get("RSA", {}) modulus = rsa_keys.get("secureInfoMod") exponent = rsa_keys.get("secureInfoExp") diff --git a/scripts/dedup.py b/scripts/dedup.py index 7c7f9a2f..32e5dd62 100644 --- a/scripts/dedup.py +++ b/scripts/dedup.py @@ -291,7 +291,6 @@ def deduplicate(bios_dir: str, dry_run: bool = False) -> dict: if not dry_run and empty_cleaned: print(f"Cleaned {empty_cleaned} empty directories") - # Write MAME clone mapping if mame_clones: # A group is only visible while both copies are on disk, and this run # has just deleted the clone. Writing only what was seen this time diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index fa7b434a..0215c59c 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -993,7 +993,6 @@ def generate_pack( agnostic_resolved = True if agnostic_resolved and local_path: - # Write rename README original_name = os.path.basename(local_path) dest_name = file_entry.get("name", "") if original_name != dest_name and agnostic_path: @@ -1537,7 +1536,6 @@ def generate_emulator_pack( if not files and not profile.get("data_directories"): print(f" No files needed for {profile.get('emulator', emu_name)}") - # Collect archives as atomic units archives: set[str] = set() for fe in files: archive = fe.get("archive") @@ -4103,7 +4101,6 @@ def generate_manifest( repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - # Filter systems by target plat_cores = _platform_cores(config, emu_profiles) if target_cores else None pack_systems = filter_systems_by_target( config.get("systems", {}), diff --git a/scripts/scraper/_hash_merge.py b/scripts/scraper/_hash_merge.py index 7c24acad..cb76848b 100644 --- a/scripts/scraper/_hash_merge.py +++ b/scripts/scraper/_hash_merge.py @@ -443,7 +443,6 @@ def _patch_bios_entries(text: str, files: list[dict]) -> str: """ import re - # Build a lookup of what to patch patches: dict[str, dict] = {} for fe in files: if fe.get("category") != "bios_zip": diff --git a/scripts/scraper/batocera_scraper.py b/scripts/scraper/batocera_scraper.py index 0dd83c6c..96b2f78d 100644 --- a/scripts/scraper/batocera_scraper.py +++ b/scripts/scraper/batocera_scraper.py @@ -444,7 +444,6 @@ class Scraper(BaseScraper): """Generate a platform YAML config dict from scraped data.""" requirements = self.fetch_requirements() - # Parse source to extract display names per system raw = self._fetch_raw() source_dict = self._extract_systems_dict(raw) display_names: dict[str, str] = {} diff --git a/scripts/scraper/bizhawk_scraper.py b/scripts/scraper/bizhawk_scraper.py index 89134c5b..dbfd7c4b 100644 --- a/scripts/scraper/bizhawk_scraper.py +++ b/scripts/scraper/bizhawk_scraper.py @@ -214,7 +214,6 @@ def parse_firmware_database( r"\s*\)" ) - # Collect firmware slots firmware_slots: dict[tuple[str, str], str] = {} for m in firmware_re.finditer(source): system, fw_id, desc = m.group(1), m.group(2), m.group(3) @@ -252,7 +251,6 @@ def parse_firmware_database( slot_key = (system, fw_id) slot_options.setdefault(slot_key, []).append((file_entry, status)) - # Build records from FirmwareAndOption one-liners records: list[dict] = [] for m in fao_re.finditer(source): diff --git a/scripts/scraper/mame_parser.py b/scripts/scraper/mame_parser.py index e337509c..de25aea6 100644 --- a/scripts/scraper/mame_parser.py +++ b/scripts/scraper/mame_parser.py @@ -372,13 +372,12 @@ def _parse_rom_entries(block: str) -> list[dict]: ("rom_load", _ROM_LOAD), ] - # Collect all matches with their positions events: list[tuple[int, str, re.Match]] = [] for tag, pat in token_patterns: for m in pat.finditer(block): events.append((m.start(), tag, m)) - # Sort by position in block + # Walked in source order: a ROM_LOAD belongs to the last ROM_REGION above it. events.sort(key=lambda e: e[0]) for _pos, tag, m in events: diff --git a/scripts/scraper/retrobat_scraper.py b/scripts/scraper/retrobat_scraper.py index 1ecfc290..c0bd706e 100644 --- a/scripts/scraper/retrobat_scraper.py +++ b/scripts/scraper/retrobat_scraper.py @@ -230,7 +230,6 @@ class Scraper(BaseScraper): """Generate a platform YAML config dict from scraped data.""" requirements = self.fetch_requirements() - # Parse source to extract display names per system raw = self._fetch_raw() source_data = json.loads(raw) display_names: dict[str, str] = {} diff --git a/scripts/scraper/retrodeck_scraper.py b/scripts/scraper/retrodeck_scraper.py index eb748bf4..22261886 100644 --- a/scripts/scraper/retrodeck_scraper.py +++ b/scripts/scraper/retrodeck_scraper.py @@ -380,7 +380,6 @@ class Scraper(BaseScraper): if system is None: continue - # Resolve path paths_raw = entry.get("paths") if isinstance(paths_raw, str): resolved = _resolve_path(paths_raw) diff --git a/scripts/sect233r1.py b/scripts/sect233r1.py index 7832dadc..3a92cfe0 100644 --- a/scripts/sect233r1.py +++ b/scripts/sect233r1.py @@ -212,11 +212,9 @@ def ecdsa_verify_sha256( if len(public_key_xy) != 60: return False - # Parse signature r = int.from_bytes(signature_rs[:30], "big") s = int.from_bytes(signature_rs[30:], "big") - # Parse public key qx = int.from_bytes(public_key_xy[:30], "big") qy = int.from_bytes(public_key_xy[30:], "big") q_point = (qx, qy) @@ -225,21 +223,20 @@ def ecdsa_verify_sha256( if not (1 <= r < _N and 1 <= s < _N): return False - # Compute hash h = hashlib.sha256(message).digest() e = int.from_bytes(h, "big") # Truncate to bit length of n if 256 > _N_BITLEN: e >>= 256 - _N_BITLEN - # Compute w = s^(-1) mod n + # w = s^(-1) mod n w = _modinv(s, _N) - # Compute u1 = e*w mod n, u2 = r*w mod n + # u1 = e*w mod n, u2 = r*w mod n u1 = (e * w) % _N u2 = (r * w) % _N - # Compute R = u1*G + u2*Q + # R = u1*G + u2*Q g_point = (_Gx, _Gy) r_point = _ec_add(_ec_mul(u1, g_point), _ec_mul(u2, q_point)) diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 2a8c43a3..0ffd0a95 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -6242,9 +6242,16 @@ class CommentsSayWhy(unittest.TestCase): REASON = re.compile(r"\b(for|only|so|because|if|when|unless|before|after)\b") def test_no_label_comment_restates_the_next_line(self): + """Three scripts were read, and 22 labels stood in 13 others.""" + tracked = subprocess.run( + ["git", "ls-files", "--", "scripts/*.py", "scripts/**/*.py", "install.py"], + cwd=ROOT, capture_output=True, text=True, check=True, + ).stdout.split() + self.assertIn("install.py", tracked) + self.assertIn("scripts/scraper/mame_parser.py", tracked) found = [] - for name in ("verify.py", "generate_site.py", "generate_truth.py"): - lines = (ROOT / "scripts" / name).read_text(encoding="utf-8").splitlines() + for name in sorted(set(tracked)): + lines = (ROOT / name).read_text(encoding="utf-8").splitlines() for index, line in enumerate(lines): if not self.LABEL.match(line) or self.REASON.search(line): continue