diff --git a/msys.py b/msys.py index 7369b4f..6f5c0b4 100644 --- a/msys.py +++ b/msys.py @@ -4,7 +4,6 @@ ARCHIVE = '.tar.xz' ARCHITECTURE = 'x86_64' CATALOG = '.files' CHARSET = 'u8' -CRT = 'mingw' DISTRIBUTION = 'distrib' REPOSITORY = 'https://repo.msys2.org' SIGNATURE = '.sig' @@ -26,16 +25,6 @@ def get_distribution(architecture): return os.path.join(DISTRIBUTION, architecture.name) -def get_subsystem(architecture, subsystem): - list = [] - if subsystem != SUBSYSTEM: - list.append(CRT) - list.append(subsystem) - if subsystem == SUBSYSTEM: - list.append(architecture.name) - return os.sep.join(list) - - def get_subsystems(architecture, families): list = [] for family in families: diff --git a/remote.py b/remote.py index 68e9f5e..7a8d865 100644 --- a/remote.py +++ b/remote.py @@ -25,8 +25,8 @@ class Remote(repository.Repository): c[architecture] = {} for subsystem in subsystems: location = os.path.join(self.location, - msys.get_subsystem(architecture, - subsystem), + architecture.subsystems[subsystem] + .path, f'{subsystem}{msys.CATALOG}') binary = requests.get(location).content c[architecture][subsystem] = catalog.Catalog(binary) diff --git a/subsystem.py b/subsystem.py index 3f34b71..cae4ed0 100644 --- a/subsystem.py +++ b/subsystem.py @@ -1,5 +1,6 @@ import os +CRT = 'mingw' MAIN = 'msys' FAMILIES = [MAIN, 'clang', 'mingw', 'ucrt'] @@ -9,10 +10,19 @@ class SubSystem: def __init__(self, architecture, name): self.architecture = architecture self.name = name + # path + list = [] + if self.name != MAIN: + list.append(CRT) + list.append(self.name) + if self.name == MAIN: + list.append(self.architecture.name) + self.path = os.sep.join(list) def __str__(self): lines = [ f'Architecture: {self.architecture.name}', f' Name: {self.name}', + f' Path: {self.path}', ] return os.linesep.join(lines) diff --git a/synchronization.py b/synchronization.py index 3899624..85be065 100644 --- a/synchronization.py +++ b/synchronization.py @@ -4,7 +4,6 @@ import shutil import arguments import file import local -import msys import remote @@ -19,7 +18,7 @@ class Synchronization: for architecture in self.remote.architectures: for subsystem in architecture.subsystems.keys(): catalog = self.remote.catalogs[architecture][subsystem] - path = msys.get_subsystem(architecture, subsystem) + path = architecture.subsystems[subsystem].path for _, package in sorted(catalog.packages.items()): f = file.File( os.path.join(self.remote.location, path),