From 279cab318aab7dc89d788ed43156f2af440d7aa4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 05:04:35 +0200 Subject: [PATCH] archives --- msys.py | 24 ++++++++++++++---------- remote.py | 8 ++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/msys.py b/msys.py index a55fdbc..9af1038 100644 --- a/msys.py +++ b/msys.py @@ -22,6 +22,20 @@ ARCHITECTURES_SUBSYSTEMS = { SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt'] +def get_distribution(architecture): + return os.path.join(DISTRIBUTION, architecture) + + +def get_subsystem(architecture, subsystem): + list = [] + if subsystem != SUBSYSTEM: + list.append(CRT) + list.append(subsystem) + if subsystem == SUBSYSTEM: + list.append(architecture) + return os.sep.join(list) + + def get_subsystems(architecture, families): list = [] bits = ARCHITECTURES_BITS[architecture] @@ -33,13 +47,3 @@ def get_subsystems(architecture, families): if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]: list.append(subsystem) return list - - -def get_subsystem(architecture, subsystem): - list = [] - if subsystem != SUBSYSTEM: - list.append(CRT) - list.append(subsystem) - if subsystem == SUBSYSTEM: - list.append(architecture) - return os.sep.join(list) diff --git a/remote.py b/remote.py index a1aba9f..726cda6 100644 --- a/remote.py +++ b/remote.py @@ -15,13 +15,13 @@ class Remote: self.load() def load(self): - a = {} + archives = {} c = {} for architecture in self.architectures: subsystems = msys.get_subsystems(architecture, self.subsystems) location = os.path.join(self.location, - msys.DISTRIBUTION, architecture) - a[architecture] = hypertext.HyperText(location).archive + msys.get_distribution(architecture)) + archives[architecture] = hypertext.HyperText(location).archive # c[architecture] = {} for subsystem in subsystems: @@ -31,7 +31,7 @@ class Remote: f'{subsystem}{msys.CATALOG}') binary = requests.get(location).content c[architecture][subsystem] = catalog.Catalog(binary) - self.archives = a + self.archives = archives self.catalogs = c def __str__(self):