From 68c15d9c39650fd342c03cd4f022509ac81150cc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 20:04:45 +0200 Subject: [PATCH] architectures --- arguments.py | 4 +++- local.py | 15 ++++++++------- msys.py | 2 -- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arguments.py b/arguments.py index 1ec5cc6..e1d4230 100644 --- a/arguments.py +++ b/arguments.py @@ -1,6 +1,7 @@ import argparse import os +import architecture import msys import subsystem @@ -48,7 +49,8 @@ action to perform onto msys repository msys remote repository's location ''') sync.add_argument(f'-{ARCHITECTURES[0]}', f'--{ARCHITECTURES}', type=str, - nargs='+', choices=msys.ARCHITECTURES, help='''\ + nargs='+', choices=architecture.ARCHITECTURES.keys(), + help='''\ list of architectures to sync ''') sync.add_argument(f'-{SUBSYSTEMS[0]}', f'--{SUBSYSTEMS}', type=str, diff --git a/local.py b/local.py index 0f96b78..fff0061 100644 --- a/local.py +++ b/local.py @@ -1,7 +1,8 @@ -import arguments import datetime import os +import architecture +import arguments import distribution import msys import repository @@ -18,14 +19,14 @@ class Local(repository.Repository): self.location, distribution.DISTRIBUTION) d = {} _, architectures, _ = next(os.walk(distro)) - for architecture in [a for a in architectures - if a in msys.ARCHITECTURES]: - directory = os.path.join(distro, architecture) + for arch in [a for a in architectures + if a in architecture.ARCHITECTURES.keys()]: + directory = os.path.join(distro, arch) _, _, files = next(os.walk(directory)) archives = sorted([file for file in files if file.endswith(msys.ARCHIVE)]) archive = archives[-1] - d[architecture] = archive + d[arch] = archive self.archives = d def get_temporary(self): @@ -38,6 +39,6 @@ class Local(repository.Repository): super().__str__(), 'Archives:', ] - for architecture, archive in reversed(sorted(self.archives.items())): - lines.append(f'{architecture} → {archive}') + for arch, archive in reversed(sorted(self.archives.items())): + lines.append(f'{arch} → {archive}') return os.linesep.join(lines) diff --git a/msys.py b/msys.py index fb810d1..76749bb 100644 --- a/msys.py +++ b/msys.py @@ -3,5 +3,3 @@ ARCHITECTURE = 'x86_64' CATALOG = '.files' CHARSET = 'u8' REPOSITORY = 'https://repo.msys2.org' - -ARCHITECTURES = [ARCHITECTURE, 'i686']