mrmp/architecture.py

39 lines
983 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 13:44:03 +00:00
X86 = 'x86_64'
I86 = 'i686'
2021-10-10 13:22:02 +00:00
class Architecture:
2021-10-10 14:27:52 +00:00
def __init__(self, name, bits, subsystems):
2021-10-10 13:22:02 +00:00
self.name = name
2021-10-10 13:44:03 +00:00
self.bits = bits
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)
2021-10-10 13:46:37 +00:00
2021-10-10 14:27:52 +00:00
x86 = Architecture(X86, 64, [subsystem.MAIN,
'clang64', 'mingw64', 'ucrt64'])
i86 = Architecture(I86, 32, [subsystem.MAIN,
'clang32', 'mingw32'])
2021-10-10 13:44:03 +00:00
ARCHITECTURES = {
2021-10-10 14:27:52 +00:00
X86: x86,
I86: i86,
2021-10-10 13:44:03 +00:00
}