mirror of
https://github.com/gryf/fs-uae-wrapper.git
synced 2026-01-05 05:14:16 +01:00
Removed bloated class and replace it with pure functions in 'plain' module
This commit is contained in:
@@ -8,33 +8,20 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Plain(object):
|
def run_plain(conf_file, fs_uae_options):
|
||||||
"""Class for run fs-uae"""
|
"""
|
||||||
|
Run the emulation.
|
||||||
def run(self, conf_file, fs_uae_options):
|
conf_file is a path to the configuration,
|
||||||
"""
|
fs_uae_options is an dict-like object which contains commandline options to
|
||||||
Run the emulation.
|
be passed to fs-uae
|
||||||
conf_file is a path to the configuration,
|
"""
|
||||||
fs_uae_options is a list contains tokenized options to be passed to
|
|
||||||
fs-uae
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
subprocess.call(['fs-uae'] + [conf_file] + fs_uae_options)
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
sys.stderr.write('Warning: fs-uae returned non 0 exit code\n')
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
"""In this class, do nothing on exit"""
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def run(config_file, fs_uae_options, _, unused):
|
|
||||||
"""Run fs-uae with provided config file and options"""
|
|
||||||
|
|
||||||
runner = Plain()
|
|
||||||
try:
|
try:
|
||||||
return runner.run(config_file, fs_uae_options)
|
subprocess.call(['fs-uae'] + [conf_file] + fs_uae_options.list())
|
||||||
finally:
|
except subprocess.CalledProcessError:
|
||||||
runner.clean()
|
sys.stderr.write('Warning: fs-uae returned non 0 exit code\n')
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def run(config_file, fs_uae_options, _):
|
||||||
|
"""Run fs-uae with provided config file and options"""
|
||||||
|
return run_plain(config_file, fs_uae_options)
|
||||||
|
|||||||
Reference in New Issue
Block a user