get_subsystems
This commit is contained in:
parent
b155d8ad83
commit
d03d9ebcbf
2 changed files with 25 additions and 13 deletions
22
msys.py
22
msys.py
|
@ -4,14 +4,28 @@ ARCHITECTURES_BITS = {
|
|||
'x86_64': 64,
|
||||
'i686': 32,
|
||||
}
|
||||
ARCHITECTURES_SUBSYSTEMS = {
|
||||
'x86_64': ['msys', 'clang64', 'mingw64', 'ucrt64'],
|
||||
'i686': ['msys', 'clang32', 'mingw32'],
|
||||
}
|
||||
CATALOG = '.files'
|
||||
CHARSET = 'u8'
|
||||
CRT = 'mingw'
|
||||
DISTRIBUTION = 'distrib'
|
||||
SIGNATURE = '.sig'
|
||||
SUBSYSTEM = 'msys'
|
||||
|
||||
ARCHITECTURES_SUBSYSTEMS = {
|
||||
'x86_64': [SUBSYSTEM, 'clang64', 'mingw64', 'ucrt64'],
|
||||
'i686': [SUBSYSTEM, 'clang32', 'mingw32'],
|
||||
}
|
||||
SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt']
|
||||
|
||||
|
||||
def get_subsystems(architecture, families):
|
||||
list = []
|
||||
bits = ARCHITECTURES_BITS[architecture]
|
||||
for family in families:
|
||||
if family == SUBSYSTEM:
|
||||
subsystem = family
|
||||
else:
|
||||
subsystem = f'{family}{bits}'
|
||||
if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]:
|
||||
list.append(subsystem)
|
||||
return list
|
||||
|
|
16
remote.py
16
remote.py
|
@ -18,24 +18,22 @@ class Remote:
|
|||
a = {}
|
||||
c = {}
|
||||
for architecture in self.architectures:
|
||||
subsystems = msys.get_subsystems(architecture, self.subsystems)
|
||||
location = os.path.join(self.location,
|
||||
msys.DISTRIBUTION, architecture)
|
||||
a[architecture] = hypertext.HyperText(location).archive
|
||||
#
|
||||
c[architecture] = {}
|
||||
for ss in self.subsystems:
|
||||
for subsystem in subsystems:
|
||||
location = self.location
|
||||
if ss == msys.SUBSYSTEMS[0]:
|
||||
subsystem = ss
|
||||
if subsystem == msys.SUBSYSTEM:
|
||||
location = os.path.join(location, subsystem, architecture)
|
||||
else:
|
||||
subsystem = f'{ss}{msys.ARCHITECTURES_BITS[architecture]}'
|
||||
location = os.path.join(location, msys.CRT, subsystem)
|
||||
if subsystem in msys.ARCHITECTURES_SUBSYSTEMS[architecture]:
|
||||
location = os.path.join(location,
|
||||
f'{subsystem}{msys.CATALOG}')
|
||||
binary = requests.get(location).content
|
||||
c[architecture][subsystem] = catalog.Catalog(binary)
|
||||
location = os.path.join(location,
|
||||
f'{subsystem}{msys.CATALOG}')
|
||||
binary = requests.get(location).content
|
||||
c[architecture][subsystem] = catalog.Catalog(binary)
|
||||
self.archives = a
|
||||
self.catalogs = c
|
||||
|
||||
|
|
Loading…
Reference in a new issue