1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-19 04:20:23 +01:00

Added additional tests for cd32 module

Also, new command was added to utils - run_command which is an
generalized subprocess.call function.

Requirements is now added with module six, which was needed to detect
string-like objects in sane way.
This commit is contained in:
2016-12-31 20:17:17 +01:00
parent 364bb9ae59
commit ef5631de3c
5 changed files with 85 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ Misc utilities
"""
from distutils import spawn
import os
import six
import subprocess
import sys
try:
@@ -105,6 +106,24 @@ def extract_archive(arch_name, show_gui_message, message_text):
return True
def run_command(cmd):
"""
Run provided command. Return true if command execution returns zero exit
code, false otherwise. If cmd is a string, there would be an attempt to
split it up for subprocess call method.
"""
if isinstance(six.text_type(cmd), six.string_types):
cmd = cmd.split()
code = subprocess.call(cmd)
if code != 0:
sys.stderr.write('Command `{0}` returned non 0 exit '
'code\n'.format(cmd[0]))
return False
return True
def merge_all_options(configuration, commandline):
"""
Merge dictionaries with wrapper options into one. Commandline options