mirror of
https://github.com/lutris/lutris
synced 2024-09-05 07:23:32 +00:00
Move get_arch to LinuxSystem
This commit is contained in:
parent
3ddf423faa
commit
297b35c146
|
@ -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 = {}
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in a new issue