mrmp/architecture.py

31 lines
913 B
Python
Raw Normal View History

2021-10-10 13:22:02 +00:00
import os
2021-10-10 16:07:20 +00:00
import arguments
2021-10-10 13:22:02 +00:00
import distribution
2021-10-10 14:27:52 +00:00
import subsystem
2021-10-10 13:22:02 +00:00
2021-10-10 17:56:24 +00:00
ARCHITECTURES = {
'x86_64': (64, [subsystem.MAIN, 'clang64', 'mingw64', 'ucrt64']),
'i686' : (32, [subsystem.MAIN, 'clang32', 'mingw32']),
}
2021-10-10 13:44:03 +00:00
2021-10-10 13:22:02 +00:00
class Architecture:
2021-10-10 17:56:24 +00:00
def __init__(self, repository, name):
self.repository = repository
2021-10-10 13:22:02 +00:00
self.name = name
2021-10-10 17:56:24 +00:00
self.bits, subsystems = ARCHITECTURES[self.name]
2021-10-10 13:22:02 +00:00
self.distribution = distribution.Distribution(self)
2021-10-10 16:07:20 +00:00
self.subsystems = {s: subsystem.SubSystem(self, s)
for s in [f if f == subsystem.MAIN
else f'{f}{self.bits}'
for f in arguments.subsystems]
if s in subsystems}
2021-10-10 13:22:02 +00:00
def __str__(self):
lines = [
f'Name: {self.name}',
2021-10-10 16:07:20 +00:00
f'Bits: {self.bits}',
2021-10-10 13:22:02 +00:00
]
return os.linesep.join(lines)