From b0ecc439614250f2adf8cc52fa0b35b2a5f99395 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 05:01:21 +0200 Subject: [PATCH] get_subsystem --- msys.py | 12 ++++++++++++ remote.py | 9 +++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/msys.py b/msys.py index aaf6a0d..a55fdbc 100644 --- a/msys.py +++ b/msys.py @@ -1,3 +1,5 @@ +import os + ARCHIVE = '.tar.xz' ARCHITECTURE = 'x86_64' CATALOG = '.files' @@ -31,3 +33,13 @@ 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 11d04e4..a1aba9f 100644 --- a/remote.py +++ b/remote.py @@ -25,12 +25,9 @@ class Remote: # c[architecture] = {} for subsystem in subsystems: - location = self.location - if subsystem == msys.SUBSYSTEM: - location = os.path.join(location, subsystem, architecture) - else: - location = os.path.join(location, msys.CRT, subsystem) - location = os.path.join(location, + location = os.path.join(self.location, + msys.get_subsystem(architecture, + subsystem), f'{subsystem}{msys.CATALOG}') binary = requests.get(location).content c[architecture][subsystem] = catalog.Catalog(binary)