From e9e6994c625df58aa90e117254deef1138c617ab Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 16:27:52 +0200 Subject: [PATCH] subsystems --- architecture.py | 15 ++++++++++----- arguments.py | 1 + remote.py | 3 +-- synchronization.py | 3 +-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/architecture.py b/architecture.py index 61f0d84..c8565fe 100644 --- a/architecture.py +++ b/architecture.py @@ -1,18 +1,18 @@ import os import distribution +import subsystem X86 = 'x86_64' I86 = 'i686' class Architecture: - def __init__(self, name, bits): + def __init__(self, name, bits, subsystems): self.name = name self.bits = bits self.distribution = distribution.Distribution(self) - # TODO subsystems - self.subsystems = {} + self.subsystems = {s: subsystem.SubSystem(self, s) for s in subsystems} def __str__(self): lines = [ @@ -21,7 +21,12 @@ class Architecture: return os.linesep.join(lines) +x86 = Architecture(X86, 64, [subsystem.MAIN, + 'clang64', 'mingw64', 'ucrt64']) +i86 = Architecture(I86, 32, [subsystem.MAIN, + 'clang32', 'mingw32']) + ARCHITECTURES = { - X86: Architecture(X86, 64), - I86: Architecture(I86, 32), + X86: x86, + I86: i86, } diff --git a/arguments.py b/arguments.py index 768a5e2..482a885 100644 --- a/arguments.py +++ b/arguments.py @@ -86,3 +86,4 @@ compression applying to archive D = parse() architectures = D[ARCHITECTURES] +subsystems = D[SUBSYSTEMS] diff --git a/remote.py b/remote.py index 1886111..68e9f5e 100644 --- a/remote.py +++ b/remote.py @@ -11,14 +11,13 @@ import repository class Remote(repository.Repository): def __init__(self, args): super().__init__(args[arguments.REMOTE]) - self.subsystems = args[arguments.SUBSYSTEMS] self.load() def load(self): archives = {} c = {} for architecture in self.architectures: - subsystems = msys.get_subsystems(architecture, self.subsystems) + subsystems = architecture.subsystems.keys() location = os.path.join(self.location, msys.get_distribution(architecture)) archives[architecture] = hypertext.HyperText(location).archive diff --git a/synchronization.py b/synchronization.py index 27956e0..3899624 100644 --- a/synchronization.py +++ b/synchronization.py @@ -17,8 +17,7 @@ class Synchronization: def run(self): for architecture in self.remote.architectures: - for subsystem in msys.get_subsystems(architecture, - self.remote.subsystems): + for subsystem in architecture.subsystems.keys(): catalog = self.remote.catalogs[architecture][subsystem] path = msys.get_subsystem(architecture, subsystem) for _, package in sorted(catalog.packages.items()):