path/subsystem

This commit is contained in:
Marc Beninca 2021-10-10 16:42:35 +02:00 committed by Marc Beninca
parent e9e6994c62
commit bb36a79cbf
4 changed files with 13 additions and 15 deletions

11
msys.py
View file

@ -4,7 +4,6 @@ ARCHIVE = '.tar.xz'
ARCHITECTURE = 'x86_64'
CATALOG = '.files'
CHARSET = 'u8'
CRT = 'mingw'
DISTRIBUTION = 'distrib'
REPOSITORY = 'https://repo.msys2.org'
SIGNATURE = '.sig'
@ -26,16 +25,6 @@ def get_distribution(architecture):
return os.path.join(DISTRIBUTION, architecture.name)
def get_subsystem(architecture, subsystem):
list = []
if subsystem != SUBSYSTEM:
list.append(CRT)
list.append(subsystem)
if subsystem == SUBSYSTEM:
list.append(architecture.name)
return os.sep.join(list)
def get_subsystems(architecture, families):
list = []
for family in families:

View file

@ -25,8 +25,8 @@ class Remote(repository.Repository):
c[architecture] = {}
for subsystem in subsystems:
location = os.path.join(self.location,
msys.get_subsystem(architecture,
subsystem),
architecture.subsystems[subsystem]
.path,
f'{subsystem}{msys.CATALOG}')
binary = requests.get(location).content
c[architecture][subsystem] = catalog.Catalog(binary)

View file

@ -1,5 +1,6 @@
import os
CRT = 'mingw'
MAIN = 'msys'
FAMILIES = [MAIN, 'clang', 'mingw', 'ucrt']
@ -9,10 +10,19 @@ class SubSystem:
def __init__(self, architecture, name):
self.architecture = architecture
self.name = name
# path
list = []
if self.name != MAIN:
list.append(CRT)
list.append(self.name)
if self.name == MAIN:
list.append(self.architecture.name)
self.path = os.sep.join(list)
def __str__(self):
lines = [
f'Architecture: {self.architecture.name}',
f' Name: {self.name}',
f' Path: {self.path}',
]
return os.linesep.join(lines)

View file

@ -4,7 +4,6 @@ import shutil
import arguments
import file
import local
import msys
import remote
@ -19,7 +18,7 @@ class Synchronization:
for architecture in self.remote.architectures:
for subsystem in architecture.subsystems.keys():
catalog = self.remote.catalogs[architecture][subsystem]
path = msys.get_subsystem(architecture, subsystem)
path = architecture.subsystems[subsystem].path
for _, package in sorted(catalog.packages.items()):
f = file.File(
os.path.join(self.remote.location, path),