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' ARCHITECTURE = 'x86_64'
CATALOG = '.files' CATALOG = '.files'
CHARSET = 'u8' CHARSET = 'u8'
CRT = 'mingw'
DISTRIBUTION = 'distrib' DISTRIBUTION = 'distrib'
REPOSITORY = 'https://repo.msys2.org' REPOSITORY = 'https://repo.msys2.org'
SIGNATURE = '.sig' SIGNATURE = '.sig'
@ -26,16 +25,6 @@ def get_distribution(architecture):
return os.path.join(DISTRIBUTION, architecture.name) 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): def get_subsystems(architecture, families):
list = [] list = []
for family in families: for family in families:

View file

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

View file

@ -1,5 +1,6 @@
import os import os
CRT = 'mingw'
MAIN = 'msys' MAIN = 'msys'
FAMILIES = [MAIN, 'clang', 'mingw', 'ucrt'] FAMILIES = [MAIN, 'clang', 'mingw', 'ucrt']
@ -9,10 +10,19 @@ class SubSystem:
def __init__(self, architecture, name): def __init__(self, architecture, name):
self.architecture = architecture self.architecture = architecture
self.name = name 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): def __str__(self):
lines = [ lines = [
f'Architecture: {self.architecture.name}', f'Architecture: {self.architecture.name}',
f' Name: {self.name}', f' Name: {self.name}',
f' Path: {self.path}',
] ]
return os.linesep.join(lines) return os.linesep.join(lines)

View file

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