mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-23 20:29:06 -05:00
feat: accept ISO country codes for --region
jp, us, kr and gb were aliases but au was unknown, and the first spelling offered for it was auto, which means world. Every territory of the region tree now answers to its ISO 3166-1 code, in the build scripts and in the installer, whose SHA-256 is pinned again.
This commit is contained in:
1 parent
4e41fad9b6
commit
10dc9a11ac
6 files changed
+74
-5
No files matched your search
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
|
||||
$defaultInstallSha256 = "1cf3bd0d3985e3a728513be75cb80682fe1e7a9224da6437e8f1cd9b2a3eedb1"
|
||||
$defaultInstallSha256 = "3f6f906ede89a0a6c350a1f85f668a213031ec8e84215595cdbd160c22ed3352"
|
||||
$maximumInstallerBytes = 2MB
|
||||
$installerExit = 0
|
||||
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
|
||||
|
||||
+24
@@ -138,6 +138,30 @@ REGION_ALIASES: dict[str, str] = {
|
||||
"korea": "south-korea",
|
||||
"auto": WORLD_REGION,
|
||||
"gb": "uk",
|
||||
"ca": "canada",
|
||||
"br": "brazil",
|
||||
"mx": "mexico",
|
||||
"ar": "argentina",
|
||||
"fr": "france",
|
||||
"de": "germany",
|
||||
"it": "italy",
|
||||
"es": "spain",
|
||||
"nl": "netherlands",
|
||||
"pt": "portugal",
|
||||
"gr": "greece",
|
||||
"pl": "poland",
|
||||
"ru": "russia",
|
||||
"se": "sweden",
|
||||
"no": "norway",
|
||||
"dk": "denmark",
|
||||
"fi": "finland",
|
||||
"cn": "china",
|
||||
"tw": "taiwan",
|
||||
"hk": "hong-kong",
|
||||
"sg": "singapore",
|
||||
"in": "india",
|
||||
"au": "australia",
|
||||
"nz": "new-zealand",
|
||||
}
|
||||
AREA_TERRITORIES: dict[str, frozenset] = {
|
||||
"asia-ntsc": frozenset({"taiwan"}),
|
||||
|
||||
+1
-1
@@ -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="3f6f906ede89a0a6c350a1f85f668a213031ec8e84215595cdbd160c22ed3352"
|
||||
MAX_INSTALLER_BYTES=2097152
|
||||
|
||||
cleanup() {
|
||||
|
||||
+27
-1
@@ -64,7 +64,9 @@ _PARENT: dict[str, str] = {
|
||||
|
||||
REGIONS: frozenset[str] = frozenset({WORLD} | set(REGION_TREE) | set(_PARENT))
|
||||
|
||||
# Accepted on the CLI and for legacy profile values.
|
||||
# Accepted on the CLI and for legacy profile values. Every territory also
|
||||
# answers to its ISO 3166-1 code: `au` alone was unknown, and the closest
|
||||
# spelling offered first was `auto`, which means world.
|
||||
ALIASES: dict[str, str] = {
|
||||
"jp": "japan",
|
||||
"ntsc-j": "japan",
|
||||
@@ -78,6 +80,30 @@ ALIASES: dict[str, str] = {
|
||||
"korea": "south-korea",
|
||||
"auto": WORLD,
|
||||
"gb": "uk",
|
||||
"ca": "canada",
|
||||
"br": "brazil",
|
||||
"mx": "mexico",
|
||||
"ar": "argentina",
|
||||
"fr": "france",
|
||||
"de": "germany",
|
||||
"it": "italy",
|
||||
"es": "spain",
|
||||
"nl": "netherlands",
|
||||
"pt": "portugal",
|
||||
"gr": "greece",
|
||||
"pl": "poland",
|
||||
"ru": "russia",
|
||||
"se": "sweden",
|
||||
"no": "norway",
|
||||
"dk": "denmark",
|
||||
"fi": "finland",
|
||||
"cn": "china",
|
||||
"tw": "taiwan",
|
||||
"hk": "hong-kong",
|
||||
"sg": "singapore",
|
||||
"in": "india",
|
||||
"au": "australia",
|
||||
"nz": "new-zealand",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1048,6 +1048,24 @@ class UnknownRegionSaysWhatToType(unittest.TestCase):
|
||||
self.assertIn("Short forms:", str(caught.exception))
|
||||
|
||||
|
||||
class CountryCodesNameTheirTerritory(unittest.TestCase):
|
||||
"""`au` was unknown while `jp`, `us`, `kr` and `gb` were aliases, and the
|
||||
first spelling offered for it was `auto`, which means world."""
|
||||
|
||||
def test_au_is_australia(self):
|
||||
self.assertEqual(region.parse_requested("au,jp"), ["australia", "japan"])
|
||||
|
||||
def test_every_territory_answers_to_a_two_letter_code(self):
|
||||
areas = set(region.AREA_TERRITORIES)
|
||||
territories = {
|
||||
member for members in region.REGION_TREE.values() for member in members
|
||||
} - areas
|
||||
coded = {
|
||||
target for alias, target in region.ALIASES.items() if len(alias) == 2
|
||||
} | {slug for slug in territories if len(slug) == 2}
|
||||
self.assertEqual(territories - coded, set())
|
||||
|
||||
|
||||
|
||||
class GenesisPlusGxUsBiosServesEurope(unittest.TestCase):
|
||||
"""sms_cart_region_detect returns REGION_USA for any export header
|
||||
|
||||
@@ -76,8 +76,9 @@ fall back to Japan. It does not mean "keep all three": when a US BIOS exists for
|
||||
a system, the European and Japanese ones are dropped.
|
||||
|
||||
Accepted names are territory slugs (`japan`, `north-america`, `europe`,
|
||||
`south-korea`, `taiwan`, `brazil`, `france`...) plus short aliases (`jp`, `us`,
|
||||
`eu`, `kr`) and the signal spellings (`ntsc-j`, `ntsc-u`, `pal`). Territories
|
||||
`south-korea`, `taiwan`, `brazil`, `france`...) plus short aliases (`us`, `eu`,
|
||||
and the ISO 3166 code of each territory: `jp`, `kr`, `au`, `br`, `fr`...) and
|
||||
the signal spellings (`ntsc-j`, `ntsc-u`, `pal`). Territories
|
||||
nest, so `--region europe` keeps a BIOS declared `[france]`, and `--region france`
|
||||
keeps one declared `[europe]`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user