architectures

This commit is contained in:
Marc Beninca 2021-10-10 15:44:03 +02:00 committed by Marc Beninca
parent f849bca87c
commit bb230e0c6d
6 changed files with 26 additions and 10 deletions

View file

@ -2,10 +2,14 @@ import os
import distribution import distribution
X86 = 'x86_64'
I86 = 'i686'
class Architecture: class Architecture:
def __init__(self, name): def __init__(self, name, bits):
self.name = name self.name = name
self.bits = bits
self.distribution = distribution.Distribution(self) self.distribution = distribution.Distribution(self)
# TODO subsystems # TODO subsystems
self.subsystems = {} self.subsystems = {}
@ -16,5 +20,7 @@ class Architecture:
] ]
return os.linesep.join(lines) return os.linesep.join(lines)
X86 = Architecture('x86_64') ARCHITECTURES = {
I86 = Architecture('i686') X86: Architecture(X86, 64),
I86: Architecture(I86, 32),
}

View file

@ -81,3 +81,7 @@ compression applying to archive
) )
return vars(parser.parse_args()) return vars(parser.parse_args())
D = parse()
architectures = D[ARCHITECTURES]

View file

@ -23,7 +23,7 @@ SUBSYSTEMS = [SUBSYSTEM, 'clang', 'mingw', 'ucrt']
def get_distribution(architecture): def get_distribution(architecture):
return os.path.join(DISTRIBUTION, architecture) return os.path.join(DISTRIBUTION, architecture.name)
def get_subsystem(architecture, subsystem): def get_subsystem(architecture, subsystem):
@ -32,18 +32,17 @@ def get_subsystem(architecture, subsystem):
list.append(CRT) list.append(CRT)
list.append(subsystem) list.append(subsystem)
if subsystem == SUBSYSTEM: if subsystem == SUBSYSTEM:
list.append(architecture) list.append(architecture.name)
return os.sep.join(list) return os.sep.join(list)
def get_subsystems(architecture, families): def get_subsystems(architecture, families):
list = [] list = []
bits = ARCHITECTURES_BITS[architecture]
for family in families: for family in families:
if family == SUBSYSTEM: if family == SUBSYSTEM:
subsystem = family subsystem = family
else: else:
subsystem = f'{family}{bits}' subsystem = f'{family}{architecture.bits}'
if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture]: if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture.name]:
list.append(subsystem) list.append(subsystem)
return list return list

View file

@ -11,7 +11,6 @@ import repository
class Remote(repository.Repository): class Remote(repository.Repository):
def __init__(self, args): def __init__(self, args):
super().__init__(args[arguments.REMOTE]) super().__init__(args[arguments.REMOTE])
self.architectures = args[arguments.ARCHITECTURES]
self.subsystems = args[arguments.SUBSYSTEMS] self.subsystems = args[arguments.SUBSYSTEMS]
self.load() self.load()

View file

@ -1,12 +1,18 @@
import os import os
import architecture
import arguments
class Repository: class Repository:
def __init__(self, location): def __init__(self, location):
self.location = location self.location = location
self.architectures = [architecture.ARCHITECTURES[a]
for a in arguments.architectures]
def __str__(self): def __str__(self):
lines = [ lines = [
f'Location: {self.location}', f' Location: {self.location}',
f'Architectures: {[a.name for a in self.architectures]}',
] ]
return os.linesep.join(lines) return os.linesep.join(lines)

View file

@ -2,6 +2,8 @@ import os
MAIN = 'msys' MAIN = 'msys'
FAMILIES = [MAIN, 'clang', 'mingw', 'ucrt']
class SubSystem: class SubSystem:
def __init__(self, architecture): def __init__(self, architecture):