This commit is contained in:
Marc Beninca 2021-10-10 20:40:14 +02:00 committed by Marc Beninca
parent 1db8c559a2
commit 3763dce133
5 changed files with 4 additions and 29 deletions

View file

@ -1,5 +1,6 @@
import os import os
ARCHIVE = '.tar.xz'
DISTRIBUTION = 'distrib' DISTRIBUTION = 'distrib'
@ -11,6 +12,8 @@ class Distribution:
def load(self): def load(self):
files = self.architecture.repository.get_files(self.path) 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): def __str__(self):
lines = [ lines = [

View file

@ -25,6 +25,3 @@ class HyperText:
parser = Parser() parser = Parser()
parser.feed(hypertext) parser.feed(hypertext)
self.links = parser.links self.links = parser.links
self.archives = [link for link in self.links
if link.endswith(msys.ARCHIVE)]
self.archive = sorted(self.archives)[-1]

View file

@ -1,10 +1,7 @@
import datetime import datetime
import os import os
import architecture
import arguments import arguments
import distribution
import msys
import repository import repository
@ -12,22 +9,6 @@ class Local(repository.Repository):
def __init__(self): def __init__(self):
super().__init__(arguments.directory) super().__init__(arguments.directory)
self.temporary = arguments.temporary 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): def get_files(self, path):
*_, files = next(os.walk(os.path.join(self.location, path))) *_, files = next(os.walk(os.path.join(self.location, path)))
@ -41,8 +22,6 @@ class Local(repository.Repository):
def __str__(self): def __str__(self):
lines = [ lines = [
super().__str__(), 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) return os.linesep.join(lines)

View file

@ -1,4 +1,3 @@
ARCHIVE = '.tar.xz'
CATALOG = '.files' CATALOG = '.files'
CHARSET = 'u8' CHARSET = 'u8'
REPOSITORY = 'https://repo.msys2.org' REPOSITORY = 'https://repo.msys2.org'

View file

@ -18,9 +18,6 @@ class Remote(repository.Repository):
c = {} c = {}
for architecture in self.architectures: for architecture in self.architectures:
subsystems = architecture.subsystems.keys() subsystems = architecture.subsystems.keys()
location = os.path.join(self.location,
architecture.distribution.path)
archives[architecture] = hypertext.HyperText(location).archive
# #
c[architecture] = {} c[architecture] = {}
for subsystem in subsystems: for subsystem in subsystems: