From 3763dce133ffc43d6fd55b127bcad3b30eab21f7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 20:40:14 +0200 Subject: [PATCH] local --- distribution.py | 3 +++ hypertext.py | 3 --- local.py | 23 +---------------------- msys.py | 1 - remote.py | 3 --- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/distribution.py b/distribution.py index 61a4b97..9f23682 100644 --- a/distribution.py +++ b/distribution.py @@ -1,5 +1,6 @@ import os +ARCHIVE = '.tar.xz' DISTRIBUTION = 'distrib' @@ -11,6 +12,8 @@ class Distribution: def load(self): files = self.architecture.repository.get_files(self.path) + self.archives = [f for f in files if f.endswith(ARCHIVE)] + self.archive = self.archives[-1] def __str__(self): lines = [ diff --git a/hypertext.py b/hypertext.py index 9252081..344d3a1 100644 --- a/hypertext.py +++ b/hypertext.py @@ -25,6 +25,3 @@ class HyperText: parser = Parser() parser.feed(hypertext) self.links = parser.links - self.archives = [link for link in self.links - if link.endswith(msys.ARCHIVE)] - self.archive = sorted(self.archives)[-1] diff --git a/local.py b/local.py index 3a5622f..2a53b80 100644 --- a/local.py +++ b/local.py @@ -1,10 +1,7 @@ import datetime import os -import architecture import arguments -import distribution -import msys import repository @@ -12,22 +9,6 @@ class Local(repository.Repository): def __init__(self): super().__init__(arguments.directory) self.temporary = arguments.temporary - self.load() - - def load(self): - distro = os.path.join( - self.location, distribution.DISTRIBUTION) - d = {} - _, architectures, _ = next(os.walk(distro)) - 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[arch] = archive - self.archives = d def get_files(self, path): *_, files = next(os.walk(os.path.join(self.location, path))) @@ -41,8 +22,6 @@ class Local(repository.Repository): def __str__(self): lines = [ super().__str__(), - 'Archives:', + f'Temporary: {self.temporary}', ] - 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 8ebbe8c..87eb923 100644 --- a/msys.py +++ b/msys.py @@ -1,4 +1,3 @@ -ARCHIVE = '.tar.xz' CATALOG = '.files' CHARSET = 'u8' REPOSITORY = 'https://repo.msys2.org' diff --git a/remote.py b/remote.py index af14821..71ae923 100644 --- a/remote.py +++ b/remote.py @@ -18,9 +18,6 @@ class Remote(repository.Repository): c = {} for architecture in self.architectures: subsystems = architecture.subsystems.keys() - location = os.path.join(self.location, - architecture.distribution.path) - archives[architecture] = hypertext.HyperText(location).archive # c[architecture] = {} for subsystem in subsystems: