From 294359d8d6a3d1c6017f0f70eb679ac365708a4b Mon Sep 17 00:00:00 2001 From: Aetias Date: Tue, 10 Sep 2024 20:19:49 +0200 Subject: [PATCH] Install dsd in `setup.py` --- .gitignore | 2 ++ tools/setup.py | 31 +++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 4390ba84..c14eaf2c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ ph_*/ *.sav *.xMAP objdiff.json +/dsd +/dsd.exe diff --git a/tools/setup.py b/tools/setup.py index e4433ca8..7e1ca021 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -2,21 +2,43 @@ import requests import zipfile import io from pathlib import Path -import subprocess -import sys import shutil +import platform + +DSD_VERSION = 'v0.1.0' + tools_path = Path(__file__).parent deps_path = tools_path / 'deps' if not deps_path.exists(): deps_path.mkdir() +root_path = tools_path.parent + + +exe_extension = '' +match platform.system(): + case 'Windows': system = 'windows'; exe_extension = '.exe' + case 'Linux': system = 'linux' + case system: + print(f'Unknown system "{system}"') + exit(1) +match platform.machine().lower(): + case 'amd64' | 'x86_64': machine = 'x86_64' + case machine: + print(f'Unknown machine: {machine}') + exit(1) + + +print('\nInstalling dsd...') +response = requests.get(f'https://github.com/AetiasHax/ds-decomp/releases/download/{DSD_VERSION}/dsd-{system}-{machine}{exe_extension}') +with open(root_path / f'dsd{exe_extension}', 'wb') as f: + f.write(response.content) + print('\nInstalling toolchain...') response = requests.get('http://decomp.aetias.com/mwccarm.zip') zip_file = zipfile.ZipFile(io.BytesIO(response.content)) zip_file.extractall(tools_path) -print('\nPatching...') -subprocess.run([sys.executable, 'patch_mwcc.py', 'mwccarm/2.0/sp1p5/mwasmarm.exe'], cwd=tools_path) print('\nInstalling ELFIO...') response = requests.get('https://github.com/serge1/ELFIO/releases/download/Release_3.12/elfio-3.12.zip') @@ -26,3 +48,4 @@ elfio_path = deps_path / 'elfio-3.12' elfio_new_path = deps_path / 'elfio' if elfio_new_path.exists(): shutil.rmtree(elfio_new_path) elfio_path.rename(elfio_new_path) +