unify download filenames (#6487)

refs https://github.com/mitmproxy/www/issues/57
This commit is contained in:
Maximilian Hils 2023-12-14 10:27:42 +01:00 committed by GitHub
parent b659ea0101
commit e992d82f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 11 deletions

View File

@ -89,17 +89,25 @@ def version() -> str:
def operating_system() -> str:
match (platform.system(), platform.machine()):
case ("Windows", _):
return "windows"
case ("Linux", _):
return "linux"
case ("Darwin", "x86_64"):
return "macos-x86_64"
case ("Darwin", "arm64"):
return "macos-arm64"
warnings.warn("Unexpected platform.")
return f"{platform.system()}-{platform.machine()}"
match platform.system():
case "Windows":
system = "windows"
case "Linux":
system = "linux"
case "Darwin":
system = "macos"
case other:
warnings.warn("Unexpected system.")
system = other
match platform.machine():
case "AMD64" | "x86_64":
machine = "x86_64"
case "arm64":
machine = "arm64"
case other:
warnings.warn("Unexpected platform.")
machine = other
return f"{system}-{machine}"
def _pyinstaller(specfile: str) -> None:
@ -350,6 +358,11 @@ def installbuilder_installer():
installer = DIST_DIR / f"mitmproxy-{version()}-windows-x64-installer.exe"
assert installer.exists()
# unify filenames
installer = installer.rename(
installer.with_name(installer.name.replace("x64", "x86_64"))
)
print("Run installer...")
subprocess.run(
[installer, "--mode", "unattended", "--unattendedmodeui", "none"], check=True