Move get_arch to LinuxSystem

This commit is contained in:
Mathieu Comandon 2018-12-21 23:31:31 -08:00
parent 3ddf423faa
commit 297b35c146
2 changed files with 17 additions and 15 deletions

View file

@ -1,6 +1,5 @@
"""Base module for runners"""
import os
import platform
from gi.repository import Gtk
@ -15,19 +14,6 @@ from lutris.util.http import Request
from lutris.runners import RunnerInstallationError
def get_arch():
"""Return the architecture returning values compatible with the reponses
from the API
"""
machine = platform.machine()
if "64" in machine:
return "x86_64"
if "86" in machine:
return "i386"
if "armv7" in machine:
return "armv7"
class Runner:
"""Generic runner (base class for other runners)."""
@ -43,7 +29,7 @@ class Runner:
def __init__(self, config=None):
"""Initialize runner."""
self.arch = get_arch()
self.arch = system.LINUX_SYSTEM.arch
self.logger = logger
self.config = config
self.game_data = {}

View file

@ -1,5 +1,6 @@
"""System utilities"""
# pylint: disable=inconsistent-return-statements
import platform
import hashlib
import signal
import os
@ -108,6 +109,7 @@ class LinuxSystem:
# Detect if system is 64bit capable
self.is_64_bit = sys.maxsize > 2 ** 32
self.arch = self.get_arch()
self.populate_libraries()
self.populate_sound_fonts()
@ -121,6 +123,20 @@ class LinuxSystem:
if os.path.exists(command_path):
return command_path
@staticmethod
def get_arch():
"""Return the system architecture only if compatible
with the supported architectures from the Lutris API
"""
machine = platform.machine()
if "64" in machine:
return "x86_64"
if "86" in machine:
return "i386"
if "armv7" in machine:
return "armv7"
logger.warning("Unsupported architecture %s", machine)
@ property
def requirements(self):
"""Return used system requirements"""