mirror of
https://github.com/lutris/lutris
synced 2024-10-14 11:42:36 +00:00
Better filtering of runtimes based on architecture
This commit is contained in:
parent
aed30cad03
commit
7b1858ae11
|
@ -48,16 +48,34 @@ class RuntimeUpdater:
|
||||||
if status_updater:
|
if status_updater:
|
||||||
self.status_updater = status_updater
|
self.status_updater = status_updater
|
||||||
|
|
||||||
return self.get_runtimes()
|
return self.download_runtimes()
|
||||||
|
|
||||||
def get_runtimes(self):
|
def _iter_runtimes(self):
|
||||||
request = http.Request(RUNTIME_URL)
|
request = http.Request(RUNTIME_URL)
|
||||||
response = request.get()
|
response = request.get()
|
||||||
runtimes = response.json or []
|
runtimes = response.json or []
|
||||||
for runtime in runtimes:
|
for runtime in runtimes:
|
||||||
name = runtime['name']
|
|
||||||
if '64' in name and not system.is_64bit:
|
# Skip 32bit runtimes on 64 bit systems except the lib32 one
|
||||||
|
if(runtime['architecture'] == 'i386'
|
||||||
|
and system.is_64bit
|
||||||
|
and runtime['name'] != 'lib32'):
|
||||||
|
logger.debug('Skipping runtime %s for %s',
|
||||||
|
runtime['name'], runtime['architecture'])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Skip 64bit runtimes on 32 bit systems
|
||||||
|
if(runtime['architecture'] == 'x86_64'
|
||||||
|
and not system.is_64bit):
|
||||||
|
logger.debug('Skipping runtime %s for %s',
|
||||||
|
runtime['name'], runtime['architecture'])
|
||||||
|
continue
|
||||||
|
|
||||||
|
yield runtime
|
||||||
|
|
||||||
|
def download_runtimes(self):
|
||||||
|
for runtime in self._iter_runtimes():
|
||||||
|
name = runtime['name']
|
||||||
created_at = runtime['created_at']
|
created_at = runtime['created_at']
|
||||||
created_at = time.strptime(created_at[:created_at.find('.')],
|
created_at = time.strptime(created_at[:created_at.find('.')],
|
||||||
"%Y-%m-%dT%H:%M:%S")
|
"%Y-%m-%dT%H:%M:%S")
|
||||||
|
|
Loading…
Reference in a new issue