This commit is contained in:
Marc Beninca 2021-10-10 05:04:35 +02:00 committed by Marc Beninca
parent b0ecc43961
commit 279cab318a
2 changed files with 18 additions and 14 deletions

24
msys.py
View file

@ -22,6 +22,20 @@ ARCHITECTURES_SUBSYSTEMS = {
SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt'] SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt']
def get_distribution(architecture):
return os.path.join(DISTRIBUTION, architecture)
def get_subsystem(architecture, subsystem):
list = []
if subsystem != SUBSYSTEM:
list.append(CRT)
list.append(subsystem)
if subsystem == SUBSYSTEM:
list.append(architecture)
return os.sep.join(list)
def get_subsystems(architecture, families): def get_subsystems(architecture, families):
list = [] list = []
bits = ARCHITECTURES_BITS[architecture] bits = ARCHITECTURES_BITS[architecture]
@ -33,13 +47,3 @@ def get_subsystems(architecture, families):
if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]: if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]:
list.append(subsystem) list.append(subsystem)
return list return list
def get_subsystem(architecture, subsystem):
list = []
if subsystem != SUBSYSTEM:
list.append(CRT)
list.append(subsystem)
if subsystem == SUBSYSTEM:
list.append(architecture)
return os.sep.join(list)

View file

@ -15,13 +15,13 @@ class Remote:
self.load() self.load()
def load(self): def load(self):
a = {} archives = {}
c = {} c = {}
for architecture in self.architectures: for architecture in self.architectures:
subsystems = msys.get_subsystems(architecture, self.subsystems) subsystems = msys.get_subsystems(architecture, self.subsystems)
location = os.path.join(self.location, location = os.path.join(self.location,
msys.DISTRIBUTION, architecture) msys.get_distribution(architecture))
a[architecture] = hypertext.HyperText(location).archive archives[architecture] = hypertext.HyperText(location).archive
# #
c[architecture] = {} c[architecture] = {}
for subsystem in subsystems: for subsystem in subsystems:
@ -31,7 +31,7 @@ class Remote:
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)
self.archives = a self.archives = archives
self.catalogs = c self.catalogs = c
def __str__(self): def __str__(self):