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,
|
'x86_64': 64,
|
||||||
'i686': 32,
|
'i686': 32,
|
||||||
}
|
}
|
||||||
ARCHITECTURES_SUBSYSTEMS = {
|
|
||||||
'x86_64': ['msys', 'clang64', 'mingw64', 'ucrt64'],
|
|
||||||
'i686': ['msys', 'clang32', 'mingw32'],
|
|
||||||
}
|
|
||||||
CATALOG = '.files'
|
CATALOG = '.files'
|
||||||
CHARSET = 'u8'
|
CHARSET = 'u8'
|
||||||
CRT = 'mingw'
|
CRT = 'mingw'
|
||||||
DISTRIBUTION = 'distrib'
|
DISTRIBUTION = 'distrib'
|
||||||
SIGNATURE = '.sig'
|
SIGNATURE = '.sig'
|
||||||
SUBSYSTEM = 'msys'
|
SUBSYSTEM = 'msys'
|
||||||
|
|
||||||
|
ARCHITECTURES_SUBSYSTEMS = {
|
||||||
|
'x86_64': [SUBSYSTEM, 'clang64', 'mingw64', 'ucrt64'],
|
||||||
|
'i686': [SUBSYSTEM, 'clang32', 'mingw32'],
|
||||||
|
}
|
||||||
SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt']
|
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 = {}
|
a = {}
|
||||||
c = {}
|
c = {}
|
||||||
for architecture in self.architectures:
|
for architecture in self.architectures:
|
||||||
|
subsystems = msys.get_subsystems(architecture, self.subsystems)
|
||||||
location = os.path.join(self.location,
|
location = os.path.join(self.location,
|
||||||
msys.DISTRIBUTION, architecture)
|
msys.DISTRIBUTION, architecture)
|
||||||
a[architecture] = hypertext.HyperText(location).archive
|
a[architecture] = hypertext.HyperText(location).archive
|
||||||
#
|
#
|
||||||
c[architecture] = {}
|
c[architecture] = {}
|
||||||
for ss in self.subsystems:
|
for subsystem in subsystems:
|
||||||
location = self.location
|
location = self.location
|
||||||
if ss == msys.SUBSYSTEMS[0]:
|
if subsystem == msys.SUBSYSTEM:
|
||||||
subsystem = ss
|
|
||||||
location = os.path.join(location, subsystem, architecture)
|
location = os.path.join(location, subsystem, architecture)
|
||||||
else:
|
else:
|
||||||
subsystem = f'{ss}{msys.ARCHITECTURES_BITS[architecture]}'
|
|
||||||
location = os.path.join(location, msys.CRT, subsystem)
|
location = os.path.join(location, msys.CRT, subsystem)
|
||||||
if subsystem in msys.ARCHITECTURES_SUBSYSTEMS[architecture]:
|
location = os.path.join(location,
|
||||||
location = os.path.join(location,
|
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 = a
|
||||||
self.catalogs = c
|
self.catalogs = c
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue