From 27ce3ca25c5b4afc88e6b4770e355bec4b8c0f63 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 16:50:15 +0200 Subject: [PATCH] path/distribution --- distribution.py | 4 ++++ local.py | 9 +++++---- msys.py | 7 ------- remote.py | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/distribution.py b/distribution.py index 4b9303d..9fad6cf 100644 --- a/distribution.py +++ b/distribution.py @@ -1,12 +1,16 @@ import os +DISTRIBUTION = 'distrib' + class Distribution: def __init__(self, architecture): self.architecture = architecture + self.path = os.sep.join([DISTRIBUTION, self.architecture.name]) def __str__(self): lines = [ f'Architecture: {self.architecture.name}', + f' Path: {self.path}', ] return os.linesep.join(lines) diff --git a/local.py b/local.py index 836ee7c..cbadd54 100644 --- a/local.py +++ b/local.py @@ -2,6 +2,7 @@ import arguments import datetime import os +import distribution import msys import repository @@ -13,13 +14,13 @@ class Local(repository.Repository): self.load() def load(self): - distribution = os.path.join( - self.location, msys.DISTRIBUTION) + distro = os.path.join( + self.location, distribution.DISTRIBUTION) d = {} - _, architectures, _ = next(os.walk(distribution)) + _, architectures, _ = next(os.walk(distro)) for architecture in [a for a in architectures if a in msys.ARCHITECTURES]: - directory = os.path.join(distribution, architecture) + directory = os.path.join(distro, architecture) _, _, files = next(os.walk(directory)) archives = sorted([file for file in files if file.endswith(msys.ARCHIVE)]) diff --git a/msys.py b/msys.py index 6f5c0b4..a01b57f 100644 --- a/msys.py +++ b/msys.py @@ -1,10 +1,7 @@ -import os - ARCHIVE = '.tar.xz' ARCHITECTURE = 'x86_64' CATALOG = '.files' CHARSET = 'u8' -DISTRIBUTION = 'distrib' REPOSITORY = 'https://repo.msys2.org' SIGNATURE = '.sig' SUBSYSTEM = 'msys' @@ -21,10 +18,6 @@ ARCHITECTURES_SUBSYSTEMS = { SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt'] -def get_distribution(architecture): - return os.path.join(DISTRIBUTION, architecture.name) - - def get_subsystems(architecture, families): list = [] for family in families: diff --git a/remote.py b/remote.py index 7a8d865..c32ca56 100644 --- a/remote.py +++ b/remote.py @@ -19,7 +19,7 @@ class Remote(repository.Repository): for architecture in self.architectures: subsystems = architecture.subsystems.keys() location = os.path.join(self.location, - msys.get_distribution(architecture)) + architecture.distribution.path) archives[architecture] = hypertext.HyperText(location).archive # c[architecture] = {}