mirror of
https://github.com/gryf/fs-uae-wrapper.git
synced 2025-12-19 12:28:12 +01:00
Added plain module - for running fs-uae directly
This commit is contained in:
0
fs_uae_wrapper/__init__.py
Normal file
0
fs_uae_wrapper/__init__.py
Normal file
38
fs_uae_wrapper/plain.py
Normal file
38
fs_uae_wrapper/plain.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Simple class for executing fs-uae with specified parameters. This is a
|
||||
failsafe class for running fs-uae.
|
||||
"""
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
class Plain(object):
|
||||
"""Class for run fs-uae"""
|
||||
|
||||
def run(self, conf, fs_uae_options):
|
||||
"""
|
||||
Run the emulation.
|
||||
conf 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] + fs_uae_options)
|
||||
except subprocess.CalledProcessError:
|
||||
sys.stderr.write('Warning: fs-uae returned non 0 exit code\n')
|
||||
|
||||
def clean(self):
|
||||
"""In this class, do nothing on exit"""
|
||||
return
|
||||
|
||||
|
||||
def run(config_file, fs_uae_options, _):
|
||||
"""Run fs-uae with provided config file and options"""
|
||||
|
||||
runner = Plain()
|
||||
try:
|
||||
runner.run(config_file, fs_uae_options)
|
||||
finally:
|
||||
runner.clean()
|
||||
Reference in New Issue
Block a user