mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 20:32:32 -05:00
refactor: consolidate CI pipeline, remove third-party deps
This commit is contained in:
@@ -11,14 +11,15 @@ Use --force to rehash all files.
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import zlib
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from common import compute_hashes
|
||||
|
||||
CACHE_DIR = ".cache"
|
||||
CACHE_FILE = os.path.join(CACHE_DIR, "db_cache.json")
|
||||
DEFAULT_BIOS_DIR = "bios"
|
||||
@@ -27,31 +28,6 @@ DEFAULT_OUTPUT = "database.json"
|
||||
SKIP_PATTERNS = {".git", ".github", "__pycache__", ".cache", ".DS_Store", "desktop.ini"}
|
||||
|
||||
|
||||
def compute_hashes(filepath: Path) -> dict:
|
||||
"""Compute SHA1, MD5, SHA256, CRC32 for a file."""
|
||||
sha1 = hashlib.sha1()
|
||||
md5 = hashlib.md5()
|
||||
sha256 = hashlib.sha256()
|
||||
crc = 0
|
||||
|
||||
with open(filepath, "rb") as f:
|
||||
while True:
|
||||
chunk = f.read(65536)
|
||||
if not chunk:
|
||||
break
|
||||
sha1.update(chunk)
|
||||
md5.update(chunk)
|
||||
sha256.update(chunk)
|
||||
crc = zlib.crc32(chunk, crc)
|
||||
|
||||
return {
|
||||
"sha1": sha1.hexdigest(),
|
||||
"md5": md5.hexdigest(),
|
||||
"sha256": sha256.hexdigest(),
|
||||
"crc32": format(crc & 0xFFFFFFFF, "08x"),
|
||||
}
|
||||
|
||||
|
||||
def should_skip(path: Path) -> bool:
|
||||
"""Check if a path should be skipped. Allows .variants/ directories."""
|
||||
for part in path.parts:
|
||||
@@ -276,8 +252,7 @@ def _collect_all_aliases(files: dict) -> dict:
|
||||
pass
|
||||
|
||||
try:
|
||||
import sys as _sys
|
||||
_sys.path.insert(0, "scripts")
|
||||
sys.path.insert(0, "scripts")
|
||||
from scraper.coreinfo_scraper import Scraper as CoreInfoScraper
|
||||
ci_reqs = CoreInfoScraper().fetch_requirements()
|
||||
for r in ci_reqs:
|
||||
|
||||
Reference in New Issue
Block a user