本文整理汇总了Python中lutris.thread.LutrisThread.run方法的典型用法代码示例。如果您正苦于以下问题:Python LutrisThread.run方法的具体用法?Python LutrisThread.run怎么用?Python LutrisThread.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lutris.thread.LutrisThread
的用法示例。
在下文中一共展示了LutrisThread.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import run [as 别名]
def execute(self, data):
"""Run an executable file."""
args = []
if isinstance(data, dict):
self._check_required_params("file", data, "execute")
file_ref = data["file"]
args_string = data.get("args", "")
for arg in shlex.split(args_string):
args.append(self._substitute(arg))
else:
file_ref = data
# Determine whether 'file' value is a file id or a path
exec_path = self._get_file(file_ref) or self._substitute(file_ref)
if not exec_path:
raise ScriptingError("Unable to find file %s" % file_ref, file_ref)
if not os.path.exists(exec_path):
raise ScriptingError("Unable to find required executable", exec_path)
self.chmodx(exec_path)
terminal = data.get("terminal")
if terminal:
terminal = system.get_default_terminal()
command = [exec_path] + args
logger.debug("Executing %s" % command)
thread = LutrisThread(command, env=runtime.get_env(), term=terminal, cwd=self.target_path)
self.abort_current_task = thread.killall
thread.run()
self.abort_current_task = None
示例2: execute
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import run [as 别名]
def execute(self, data):
"""Run an executable file"""
args = []
if isinstance(data, dict):
self._check_required_params('file', data, 'execute')
file_ref = data['file']
args_string = data.get('args', '')
for arg in shlex.split(args_string):
args.append(self._substitute(arg))
else:
file_ref = data
# Determine whether 'file' value is a file id or a path
exec_path = self._get_file(file_ref) or self._substitute(file_ref)
if not exec_path:
raise ScriptingError("Unable to find file %s" % file_ref,
file_ref)
if not os.path.exists(exec_path):
raise ScriptingError("Unable to find required executable",
exec_path)
self.chmodx(exec_path)
terminal = data.get('terminal')
if terminal:
terminal = system.get_default_terminal()
command = [exec_path] + args
logger.debug("Executing %s" % command)
thread = LutrisThread(command, env=get_runtime_env(), term=terminal)
thread.run()
示例3: execute
# 需要导入模块: from lutris.thread import LutrisThread [as 别名]
# 或者: from lutris.thread.LutrisThread import run [as 别名]
def execute(self, data):
"""Run an executable file."""
args = []
terminal = None
working_dir = None
if isinstance(data, dict):
self._check_required_params('file', data, 'execute')
file_ref = data['file']
args_string = data.get('args', '')
for arg in shlex.split(args_string):
args.append(self._substitute(arg))
terminal = data.get('terminal')
working_dir = data.get('working_dir')
else:
file_ref = data
# Determine whether 'file' value is a file id or a path
exec_path = self._get_file(file_ref) or self._substitute(file_ref)
if not exec_path:
raise ScriptingError("Unable to find file %s" % file_ref,
file_ref)
if not os.path.exists(exec_path):
raise ScriptingError("Unable to find required executable",
exec_path)
if not os.access(exec_path, os.X_OK):
self.chmodx(exec_path)
if terminal:
terminal = system.get_default_terminal()
if not working_dir or not os.path.exists(working_dir):
working_dir = self.target_path
command = [exec_path] + args
logger.debug("Executing %s" % command)
thread = LutrisThread(command, env=runtime.get_env(), term=terminal,
cwd=self.target_path, watch=False)
self.abort_current_task = thread.killall
thread.run()
self.abort_current_task = None