1 from os
.path
import exists
2 from logging
import info
4 from lib
.gameobject
import LogicColleague
5 from lib
.engine
.configuration
import Cfg
6 from lib
.gameobject
import GameObject
7 from lib
.computer_proxy
import ComputerProxy
, compute_once
10 class VersionChecker(GameObject
, ComputerProxy
):
13 GameObject
.__init
__(self
)
14 ComputerProxy
.__init
__(self
)
17 def is_uptodate(self
):
18 return True # currently the server part is not active
19 self
.eng
.client
.register_rpc('srv_version')
20 try: ver
= self
.eng
.client
.srv_version()
21 except AttributeError:
22 print("can't retrieve the version")
24 major
, minor
, build
= ver
.split('.')
25 major
, minor
, build
= int(major
), int(minor
), int(build
)
26 curr_ver
= self
.eng
.version
27 if curr_ver
== 'deploy-ng': return True
28 info('versions: %s %s' % (curr_ver
, ver
))
29 return curr_ver
>= ver
30 # curr_major, curr_minor, curr_build = curr_ver.split('-')[0].split('.')
31 # curr_major = int(curr_major)
32 # curr_minor = int(curr_minor)
33 # curr_build = int(curr_build)
34 # return curr_major > major or \
35 # curr_major == major and curr_minor > minor or \
36 # curr_major == major and curr_minor == minor and curr_build >= build
39 GameObject
.destroy(self
)
40 # ComputerProxy.destroy(self) # raises an exception
43 class EngineLogic(LogicColleague
):
47 return [arg
for arg
in iter(argv
[1:]) if not arg
.startswith('-psn_')]
49 def __init__(self
, mediator
, cfg
=None):
50 LogicColleague
.__init
__(self
, mediator
)
51 self
.cfg
= cfg
or Cfg() # use a default conf if not provided
55 #if not self.is_runtime:
56 # if not exists('assets/version.txt'): return '-'
57 # with open('assets/version.txt') as fver:
58 # return fver.read().strip() + '-source'
59 # ^ --version goes here
60 return self
.mediator
.lib
.build_version
64 return self
.mediator
.lib
.runtime()
68 return self
.mediator
.lib
.curr_path
+ '/' \
69 if self
.is_runtime
else ''
72 def is_appimage(self
):
73 return self
.mediator
.lib
.is_appimage
77 LogicColleague
.destroy(self
)