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

View file

@ -81,3 +81,7 @@ compression applying to archive
)
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):
return os.path.join(DISTRIBUTION, architecture)
return os.path.join(DISTRIBUTION, architecture.name)
def get_subsystem(architecture, subsystem):
@ -32,18 +32,17 @@ def get_subsystem(architecture, subsystem):
list.append(CRT)
list.append(subsystem)
if subsystem == SUBSYSTEM:
list.append(architecture)
list.append(architecture.name)
return os.sep.join(list)
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]:
subsystem = f'{family}{architecture.bits}'
if subsystem in ARCHITECTURES_SUBSYSTEMS[architecture.name]:
list.append(subsystem)
return list

View file

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

View file

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

View file

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