From 7d3c4828fd27db8aad1ef28ddfb55af7c2055fc8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 9 Oct 2021 21:39:10 +0200 Subject: [PATCH] architectures/subsystems --- arguments.py | 2 +- remote.py | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/arguments.py b/arguments.py index 4e99419..12aaafe 100644 --- a/arguments.py +++ b/arguments.py @@ -74,7 +74,7 @@ compression applying to archive remote='https://repo.msys2.org', architectures=['x86_64'], - subsystems=['msys', 'mingw64'], + subsystems=['msys', 'mingw'], filesystem='fs', compression='zst', diff --git a/remote.py b/remote.py index eeecb37..f9e525c 100644 --- a/remote.py +++ b/remote.py @@ -7,12 +7,20 @@ import hypertext ARCHIVE = '.tar.xz' ARCHITECTURES = ['x86_64', 'i686'] +ARCHITECTURES_BITS = { +'x86_64': 64, +'i686': 32, +} +ARCHITECTURES_SUBSYSTEMS = { +'x86_64': ['msys', 'clang64', 'mingw64', 'ucrt64'], +'i686': ['msys', 'clang32', 'mingw32'], +} CHARSET = 'u8' DISTRIBUTION = 'distrib' FILES = '.files' MINGW = 'mingw' SIGNATURE = '.sig' -SUBSYSTEMS = ['msys', 'mingw64'] +SUBSYSTEMS = ['msys', 'clang', 'mingw', 'ucrt'] class Remote: @@ -34,14 +42,18 @@ class Remote: archive = archives[-1] a[architecture] = archive # - for subsystem in self.subsystems: - location = [self.location] - if subsystem != SUBSYSTEMS[0]: - location.append(MINGW) - location = os.path.join(*location, subsystem, architecture, - f'{subsystem}{FILES}') - binary = requests.get(url).content - c[architecture] = binary + for ss in self.subsystems: + location = self.location + if ss == SUBSYSTEMS[0]: + subsystem = ss + location = os.path.join(location, subsystem, architecture) + else: + subsystem = f'{ss}{ARCHITECTURES_BITS[architecture]}' + location = os.path.join(location, MINGW, subsystem) + if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]: + location = os.path.join(location, f'{subsystem}{FILES}') + binary = requests.get(url).content + c[architecture] = binary self.archives = a self.catalogs = c @@ -50,5 +62,4 @@ class Remote: 'Archives:'] for architecture, archive in reversed(sorted(self.archives.items())): lines.append(f'{architecture} → {archive}') - lines.append(f'Subsystems: {self.subsystems}') return os.linesep.join(lines)