path/distribution

This commit is contained in:
Marc Beninca 2021-10-10 16:50:15 +02:00 committed by Marc Beninca
parent bb36a79cbf
commit 27ce3ca25c
4 changed files with 10 additions and 12 deletions

View file

@ -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)

View file

@ -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)])

View file

@ -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:

View file

@ -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] = {}