mirror of
https://github.com/gryf/fs-uae-wrapper.git
synced 2026-02-03 23:05:45 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68b1f2a787 | |||
| 75d2cff96c | |||
| 114984cbee | |||
| b015e443eb | |||
| 874213aef9 | |||
| 1559591417 | |||
| 193e487bb9 | |||
| eb9012f3fa | |||
| efbb5f6f05 |
@@ -2,7 +2,10 @@ language: python
|
|||||||
env:
|
env:
|
||||||
- TOXENV=py27
|
- TOXENV=py27
|
||||||
- TOXENV=py27-flake8
|
- TOXENV=py27-flake8
|
||||||
- TOXENV=py34
|
- TOXENV=py3
|
||||||
- TOXENV=py34-flake8
|
- TOXENV=py3-flake8
|
||||||
install: pip install tox
|
install: pip install tox
|
||||||
script: tox
|
script: tox
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install -y python-tk python3-tk
|
||||||
|
|||||||
65
README.rst
65
README.rst
@@ -12,7 +12,7 @@ This little utility is a wrapper on great FS-UAE_ emulator, to perform some
|
|||||||
actions, like uncompressing archived files (CD ROMs images, filesystems),
|
actions, like uncompressing archived files (CD ROMs images, filesystems),
|
||||||
launch the emulator and archive emulator save state.
|
launch the emulator and archive emulator save state.
|
||||||
|
|
||||||
As an example, if there is a collection of CD³² game files and one want to
|
As an example, if there is a collection of CD³² game files and you want to
|
||||||
provide configuration for each game, but want to keep ISO images with
|
provide configuration for each game, but want to keep ISO images with
|
||||||
corresponding files in archive (due to size of those images) than FS-UAE
|
corresponding files in archive (due to size of those images) than FS-UAE
|
||||||
Wrapper is a way to achieve this.
|
Wrapper is a way to achieve this.
|
||||||
@@ -25,11 +25,10 @@ preferably in a archive file vs a bunch of files.
|
|||||||
Requirements
|
Requirements
|
||||||
============
|
============
|
||||||
|
|
||||||
- Python (2 or 3)
|
- Python 3
|
||||||
- `fs-uae`_ (obviously :)
|
- `fs-uae`_ (obviously :)
|
||||||
|
|
||||||
Also, there should be archivers programs available for compress/decompress
|
Fs-uae-wrapper supports several types of archives:
|
||||||
archives. Fs-uae-wrapper supports several types of archives:
|
|
||||||
|
|
||||||
- `7z`_
|
- `7z`_
|
||||||
- `lha`_
|
- `lha`_
|
||||||
@@ -43,25 +42,35 @@ archives. Fs-uae-wrapper supports several types of archives:
|
|||||||
|
|
||||||
- `zip`_
|
- `zip`_
|
||||||
|
|
||||||
There are several archive types which are supported, ranging from tar
|
All of those formats should have corresponding software available in the
|
||||||
(compressed with gzip, bzip2 and xz), 7z, rar, zip. lha and lzx. All of those
|
system, otherwise archive extraction/compression will fail.
|
||||||
formats should have corresponding decompressors available in the system,
|
|
||||||
otherwise archive extraction will fail.
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
Just perform (preferably in ``virtualenv``) a command:
|
FS-UAE Wrapper is available on `CheeseShop`_ (or python package index if you
|
||||||
|
will). To install it, you can simply invoke (preferably in ``virtualenv``) a
|
||||||
|
command:
|
||||||
|
|
||||||
.. code:: shell-session
|
.. code:: shell-session
|
||||||
|
|
||||||
$ pip install fs-uae-wrapper
|
$ pip install fs-uae-wrapper
|
||||||
|
|
||||||
|
Note, that if ``virtualenv`` was used, there is no need for activating it every
|
||||||
|
time, since if invoke wrapper like this:
|
||||||
|
|
||||||
|
.. code:: shell-session
|
||||||
|
|
||||||
|
$ /path/to/virtualenv/bin/fs-uae-wrapper
|
||||||
|
|
||||||
|
you should be able run the wrapper properly. *Tested only on Linux :)*.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
After installation you should be able to access new command
|
After installation you should be able to access new command ``fs-uae-wrapper``
|
||||||
``fs-uae-wrapper``, and its invocation is identical like ``fs-uae`` binary:
|
(or use the full path to the ``virtualenv`` like on the section above), and it's
|
||||||
|
invocation is identical like ``fs-uae`` binary:
|
||||||
|
|
||||||
.. code:: shell-session
|
.. code:: shell-session
|
||||||
|
|
||||||
@@ -73,9 +82,9 @@ directly in fs-uae configuration or passed as an option:
|
|||||||
.. code:: ini
|
.. code:: ini
|
||||||
|
|
||||||
[config]
|
[config]
|
||||||
...
|
# ...
|
||||||
wrapper = cd32
|
wrapper = cd32
|
||||||
...
|
# ...
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
@@ -89,15 +98,19 @@ specific module will be loaded and depending on the module, there would be
|
|||||||
performed specific tasks before ``fs-uae`` is launched and after it.
|
performed specific tasks before ``fs-uae`` is launched and after it.
|
||||||
|
|
||||||
Assumption is, that configuration file are written in portable way, so the are
|
Assumption is, that configuration file are written in portable way, so the are
|
||||||
saved as `relative configuration file`_ (hence the name ``Config.fs-uae``, even
|
saved as `relative configuration file`_ (hence the name ``Config.fs-uae``),
|
||||||
if the are named differently. If certain wrapper is specified, it will create
|
even if the are named differently. If certain wrapper is specified, it will
|
||||||
temporary directory and place the configuration file there as
|
create temporary directory and place the configuration file there as
|
||||||
``Config.fs-uae``.
|
``Config.fs-uae``.
|
||||||
|
|
||||||
If no ``wrapper`` option would be passed either as an config option or
|
If no ``wrapper`` option would be passed either as an config option or
|
||||||
command line argument, all command line options will be passed to the fs-uae
|
command line argument, all command line options will be passed to the fs-uae
|
||||||
executable as-is.
|
executable as-is.
|
||||||
|
|
||||||
|
Note, that you can also pass all *wrapper* options via commandline in the very
|
||||||
|
same way as you can pass config options to `fs-uae`, so you don't have to
|
||||||
|
modify original configuration if you don't want to.
|
||||||
|
|
||||||
There is also new config variable introduced: ``$WRAPPER`` which have the same
|
There is also new config variable introduced: ``$WRAPPER`` which have the same
|
||||||
role as ``$CONFIG``, but apply for copied config. For instance - in module
|
role as ``$CONFIG``, but apply for copied config. For instance - in module
|
||||||
archive there are filesystem extracted to new location - to access this
|
archive there are filesystem extracted to new location - to access this
|
||||||
@@ -108,7 +121,7 @@ a config option:
|
|||||||
|
|
||||||
[config]
|
[config]
|
||||||
wrapper = archive
|
wrapper = archive
|
||||||
...
|
# ...
|
||||||
|
|
||||||
hard_drive_0 = $WRAPPER/my_hardrive
|
hard_drive_0 = $WRAPPER/my_hardrive
|
||||||
|
|
||||||
@@ -118,7 +131,7 @@ directory, where configuration will be copied.
|
|||||||
Modules
|
Modules
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Currently, three wrapper modules are available:
|
Currently, couple of wrapper modules are available:
|
||||||
|
|
||||||
- plain
|
- plain
|
||||||
- cd32
|
- cd32
|
||||||
@@ -149,7 +162,7 @@ Options used:
|
|||||||
* ``wrapper_gui_msg`` (optional) if set to "1", will display a graphical
|
* ``wrapper_gui_msg`` (optional) if set to "1", will display a graphical
|
||||||
message during extracting files
|
message during extracting files
|
||||||
* ``wrapper_save_state`` (optional) if set to "1", will load/archive save state
|
* ``wrapper_save_state`` (optional) if set to "1", will load/archive save state
|
||||||
directory, defined as ``$CONFIG/[save-state-dir-name]`` using provided
|
directory, defined as ``$WRAPPER/[save-state-dir-name]`` using provided
|
||||||
``wrapper_archiver`` archiver. If this option is enabled,
|
``wrapper_archiver`` archiver. If this option is enabled,
|
||||||
``wrapper_archiver`` will be required.
|
``wrapper_archiver`` will be required.
|
||||||
|
|
||||||
@@ -170,11 +183,11 @@ fragment of configuration file is saved as ``ChaosEngine.fs-uae``:
|
|||||||
|
|
||||||
cdrom_drive_0 = Chaos Engine, The (1994)(Renegade)(M4)[!][CDD3445].cue
|
cdrom_drive_0 = Chaos Engine, The (1994)(Renegade)(M4)[!][CDD3445].cue
|
||||||
|
|
||||||
save_states_dir = $CONFIG/fs-uae-save/
|
save_states_dir = $WRAPPER/fs-uae-save/
|
||||||
|
|
||||||
joystick_port_1_mode = cd32 gamepad
|
joystick_port_1_mode = cd32 gamepad
|
||||||
platform = cd32
|
platform = cd32
|
||||||
...
|
# ...
|
||||||
|
|
||||||
Command line invocation of the wrapper would be as follows:
|
Command line invocation of the wrapper would be as follows:
|
||||||
|
|
||||||
@@ -186,7 +199,7 @@ Now, there several thing will happen:
|
|||||||
|
|
||||||
- Config file will be read, and wrapper module will be found
|
- Config file will be read, and wrapper module will be found
|
||||||
- New temporary directory will be created
|
- New temporary directory will be created
|
||||||
- Archive with game assists will be extracted in that directory
|
- Archive with game assets will be extracted in that directory
|
||||||
- Configuration file will be copied into that directory, and renamed to
|
- Configuration file will be copied into that directory, and renamed to
|
||||||
``Config.fs-uae``
|
``Config.fs-uae``
|
||||||
- If ``wrapper_save_state`` is set, and there is saved state archive, it also
|
- If ``wrapper_save_state`` is set, and there is saved state archive, it also
|
||||||
@@ -215,7 +228,7 @@ Options used:
|
|||||||
* ``wrapper_persist_data`` (optional) if set to "1", will compress (possibly
|
* ``wrapper_persist_data`` (optional) if set to "1", will compress (possibly
|
||||||
changed) data, replacing original archive
|
changed) data, replacing original archive
|
||||||
* ``wrapper_save_state`` (optional) if set to "1", will archive save state
|
* ``wrapper_save_state`` (optional) if set to "1", will archive save state
|
||||||
directory, defined as ``$CONFIG/[save-state-dir-name]`` using provided
|
directory, defined as ``$WRAPPER/[save-state-dir-name]`` using provided
|
||||||
``wrapper_archiver`` archiver. If this option is enabled,
|
``wrapper_archiver`` archiver. If this option is enabled,
|
||||||
``wrapper_archiver`` will be required.
|
``wrapper_archiver`` will be required.
|
||||||
|
|
||||||
@@ -237,7 +250,7 @@ Example configuration:
|
|||||||
wrapper_gui_msg = 1
|
wrapper_gui_msg = 1
|
||||||
wrapper_persist_data = 1
|
wrapper_persist_data = 1
|
||||||
wrapper_save_state = 1
|
wrapper_save_state = 1
|
||||||
...
|
# ...
|
||||||
|
|
||||||
And execution is as usual:
|
And execution is as usual:
|
||||||
|
|
||||||
@@ -276,12 +289,11 @@ set to value ``1`` in this module.
|
|||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
.. code:: ini
|
.. code:: ini
|
||||||
:number-lines:
|
|
||||||
|
|
||||||
[config]
|
[config]
|
||||||
wrapper = savestate
|
wrapper = savestate
|
||||||
wrapper_archiver = 7z
|
wrapper_archiver = 7z
|
||||||
...
|
# ...
|
||||||
|
|
||||||
And execution is as usual:
|
And execution is as usual:
|
||||||
|
|
||||||
@@ -312,3 +324,4 @@ This work is licensed on 3-clause BSD license. See LICENSE file for details.
|
|||||||
.. _lzx: http://aminet.net/package/misc/unix/unlzx.c.readme
|
.. _lzx: http://aminet.net/package/misc/unix/unlzx.c.readme
|
||||||
.. _tar: https://www.gnu.org/software/tar/
|
.. _tar: https://www.gnu.org/software/tar/
|
||||||
.. _zip: http://www.info-zip.org
|
.. _zip: http://www.info-zip.org
|
||||||
|
.. _CheeseShop: https://pypi.python.org/pypi/fs-/fs-uae-wrapperuae-wrapper
|
||||||
|
|||||||
@@ -219,7 +219,11 @@ class Base(object):
|
|||||||
changed_options[key] = abspath
|
changed_options[key] = abspath
|
||||||
continue
|
continue
|
||||||
|
|
||||||
changed_options[key] = os.path.abspath(val)
|
_val = os.path.abspath(val)
|
||||||
|
if os.path.exists(_val):
|
||||||
|
changed_options[key] = _val
|
||||||
|
else:
|
||||||
|
changed_options[key] = val
|
||||||
|
|
||||||
self.fsuae_options.update(changed_options)
|
self.fsuae_options.update(changed_options)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Simple class for executing fs-uae with specified parameters. This is a
|
Simple class for executing fs-uae with specified parameters. This is a
|
||||||
failsafe class for running fs-uae.
|
failsafe class for running fs-uae.
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
"""
|
"""
|
||||||
Misc utilities
|
Misc utilities
|
||||||
"""
|
"""
|
||||||
from distutils import spawn
|
import configparser
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
|
||||||
import configparser
|
|
||||||
except ImportError:
|
|
||||||
import ConfigParser as configparser
|
|
||||||
|
|
||||||
from fs_uae_wrapper import message
|
from fs_uae_wrapper import message
|
||||||
from fs_uae_wrapper import file_archive
|
from fs_uae_wrapper import file_archive
|
||||||
@@ -46,7 +43,7 @@ class CmdOption(dict):
|
|||||||
|
|
||||||
def get_config_options(conf):
|
def get_config_options(conf):
|
||||||
"""Read config file and return options as a dict"""
|
"""Read config file and return options as a dict"""
|
||||||
parser = configparser.SafeConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
parser.read(conf)
|
parser.read(conf)
|
||||||
except configparser.ParsingError:
|
except configparser.ParsingError:
|
||||||
@@ -144,6 +141,7 @@ def interpolate_variables(string, config_path, base=None):
|
|||||||
- $BASE
|
- $BASE
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
_string = string
|
||||||
if '$CONFIG' in string:
|
if '$CONFIG' in string:
|
||||||
conf_path = os.path.dirname(os.path.abspath(config_path))
|
conf_path = os.path.dirname(os.path.abspath(config_path))
|
||||||
string = os.path.abspath(string.replace('$CONFIG', conf_path))
|
string = os.path.abspath(string.replace('$CONFIG', conf_path))
|
||||||
@@ -152,10 +150,10 @@ def interpolate_variables(string, config_path, base=None):
|
|||||||
string = string.replace('$HOME', os.path.expandvars('$HOME'))
|
string = string.replace('$HOME', os.path.expandvars('$HOME'))
|
||||||
|
|
||||||
if '$EXE' in string:
|
if '$EXE' in string:
|
||||||
string = string.replace('$EXE', spawn.find_executable('fs-uae'))
|
string = string.replace('$EXE', shutil.which('fs-uae'))
|
||||||
|
|
||||||
if '$APP' in string:
|
if '$APP' in string:
|
||||||
string = string.replace('$APP', spawn.find_executable('fs-uae'))
|
string = string.replace('$APP', shutil.which('fs-uae'))
|
||||||
|
|
||||||
if '$DOCUMENTS' in string:
|
if '$DOCUMENTS' in string:
|
||||||
xdg_docs = os.getenv('XDG_DOCUMENTS_DIR',
|
xdg_docs = os.getenv('XDG_DOCUMENTS_DIR',
|
||||||
@@ -166,7 +164,9 @@ def interpolate_variables(string, config_path, base=None):
|
|||||||
if '$BASE' in string:
|
if '$BASE' in string:
|
||||||
string = string.replace('$BASE', base)
|
string = string.replace('$BASE', base)
|
||||||
|
|
||||||
|
if os.path.exists(string):
|
||||||
return string
|
return string
|
||||||
|
return _string
|
||||||
|
|
||||||
|
|
||||||
def get_config(conf_file):
|
def get_config(conf_file):
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
"""
|
"""
|
||||||
Wrapper for FS-UAE to perform some actions before and or after running the
|
Wrapper for FS-UAE to perform some actions before and or after running the
|
||||||
emulator, if appropriate option is enabled.
|
emulator, if appropriate option is enabled.
|
||||||
@@ -119,7 +118,3 @@ def run():
|
|||||||
|
|
||||||
if not exit_code:
|
if not exit_code:
|
||||||
sys.exit(4)
|
sys.exit(4)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
run()
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
Run CD32 games using fsuae
|
|
||||||
"""
|
|
||||||
|
|
||||||
from fs_uae_wrapper import wrapper
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""run wrapper"""
|
|
||||||
wrapper.run()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
37
setup.cfg
Normal file
37
setup.cfg
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[metadata]
|
||||||
|
name = fs-uae-wrapper
|
||||||
|
summary = Automate archives and state for fs-uae
|
||||||
|
description = Automate archives and state for fs-uae
|
||||||
|
long_description = file: README.rst
|
||||||
|
author = Roman Dobosz
|
||||||
|
author_email = gryf73@gmail.com
|
||||||
|
url = https://github.com/gryf/fs-uae-wrapper
|
||||||
|
license = BSD
|
||||||
|
keywords = uae, fs-uae, amiga, emulator, wrapper
|
||||||
|
version = 0.8.3
|
||||||
|
classifier =
|
||||||
|
Development Status :: 5 - Production/Stable
|
||||||
|
Environment :: Console
|
||||||
|
Intended Audience :: End Users/Desktop
|
||||||
|
License :: OSI Approved :: BSD License
|
||||||
|
Operating System :: OS Independent
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
|
Programming Language :: Python :: 3.9
|
||||||
|
Programming Language :: Python :: 3.10
|
||||||
|
Topic :: System :: Emulators
|
||||||
|
Topic :: Games/Entertainment
|
||||||
|
|
||||||
|
[install]
|
||||||
|
record = install.log
|
||||||
|
|
||||||
|
[options.entry_points]
|
||||||
|
console_scripts =
|
||||||
|
fs-uae-wrapper = fs_uae_wrapper.wrapper:run
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
fs_uae_wrapper
|
||||||
|
|
||||||
|
[bdist_wheel]
|
||||||
|
universal = 1
|
||||||
30
setup.py
30
setup.py
@@ -1,31 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""
|
import setuptools
|
||||||
Setup for the fs-uae-wrapper
|
|
||||||
"""
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
|
|
||||||
setup(name='fs-uae-wrapper',
|
setuptools.setup()
|
||||||
packages=['fs_uae_wrapper'],
|
|
||||||
version='0.8',
|
|
||||||
description='Automate archives and state for fs-uae',
|
|
||||||
author='Roman Dobosz',
|
|
||||||
author_email='gryf73@gmail.com',
|
|
||||||
url='https://github.com/gryf/fs-uea-wrapper',
|
|
||||||
download_url='https://github.com/gryf/pygtktalog.git',
|
|
||||||
keywords=['uae', 'fs-uae', 'amiga', 'emulator', 'wrapper'],
|
|
||||||
scripts=['script/fs-uae-wrapper'],
|
|
||||||
classifiers=['Programming Language :: Python :: 2',
|
|
||||||
'Programming Language :: Python :: 2.7',
|
|
||||||
'Programming Language :: Python :: 3',
|
|
||||||
'Programming Language :: Python :: 3.4',
|
|
||||||
'Development Status :: 4 - Beta',
|
|
||||||
'Environment :: Console',
|
|
||||||
'Intended Audience :: End Users/Desktop',
|
|
||||||
'License :: OSI Approved :: BSD License',
|
|
||||||
'Operating System :: OS Independent',
|
|
||||||
'Topic :: System :: Emulators',
|
|
||||||
'Topic :: Games/Entertainment'],
|
|
||||||
long_description=open('README.rst').read(),
|
|
||||||
options={'test': {'verbose': False,
|
|
||||||
'coverage': False}})
|
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ class TestBase(TestCase):
|
|||||||
bobj.clean()
|
bobj.clean()
|
||||||
self.assertFalse(os.path.exists(self.dirname))
|
self.assertFalse(os.path.exists(self.dirname))
|
||||||
|
|
||||||
|
@mock.patch('os.path.exists')
|
||||||
@mock.patch('fs_uae_wrapper.utils.get_config')
|
@mock.patch('fs_uae_wrapper.utils.get_config')
|
||||||
def test_normalize_options(self, get_config):
|
def test_normalize_options(self, get_config, os_exists):
|
||||||
|
|
||||||
|
os_exists.return_value = True
|
||||||
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
|
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
|
||||||
|
|
||||||
get_config.return_value = {'kickstarts_dir': '/some/path'}
|
get_config.return_value = {'kickstarts_dir': '/some/path'}
|
||||||
@@ -92,6 +94,28 @@ class TestBase(TestCase):
|
|||||||
bobj._normalize_options()
|
bobj._normalize_options()
|
||||||
self.assertDictEqual(bobj.fsuae_options, {})
|
self.assertDictEqual(bobj.fsuae_options, {})
|
||||||
|
|
||||||
|
@mock.patch('os.path.exists')
|
||||||
|
@mock.patch('fs_uae_wrapper.utils.get_config')
|
||||||
|
def test_normalize_options_path_not_exists(self, get_config, os_exists):
|
||||||
|
|
||||||
|
os_exists.return_value = False
|
||||||
|
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
|
||||||
|
|
||||||
|
get_config.return_value = {'kickstarts_dir': '/some/path'}
|
||||||
|
bobj._normalize_options()
|
||||||
|
self.assertDictEqual(bobj.fsuae_options, {})
|
||||||
|
|
||||||
|
os.chdir(self.dirname)
|
||||||
|
get_config.return_value = {'fmv_rom': 'bar'}
|
||||||
|
bobj._normalize_options()
|
||||||
|
self.assertDictEqual(bobj.fsuae_options, {'fmv_rom': 'bar'})
|
||||||
|
|
||||||
|
get_config.return_value = {'floppies_dir': '../some/path'}
|
||||||
|
bobj.fsuae_options = utils.CmdOption()
|
||||||
|
bobj._normalize_options()
|
||||||
|
self.assertDictEqual(bobj.fsuae_options,
|
||||||
|
{'floppies_dir': '../some/path'})
|
||||||
|
|
||||||
def test_set_assets_paths(self):
|
def test_set_assets_paths(self):
|
||||||
|
|
||||||
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
|
bobj = base.Base('Config.fs-uae', utils.CmdOption(), {})
|
||||||
|
|||||||
@@ -234,11 +234,13 @@ class TestCmdOptions(TestCase):
|
|||||||
self.assertListEqual(sorted(cmd.list()),
|
self.assertListEqual(sorted(cmd.list()),
|
||||||
['--fast_memory=4096', '--fullscreen'])
|
['--fast_memory=4096', '--fullscreen'])
|
||||||
|
|
||||||
|
@mock.patch('os.path.exists')
|
||||||
@mock.patch('os.getenv')
|
@mock.patch('os.getenv')
|
||||||
@mock.patch('os.path.expandvars')
|
@mock.patch('os.path.expandvars')
|
||||||
@mock.patch('distutils.spawn.find_executable')
|
@mock.patch('distutils.spawn.find_executable')
|
||||||
def test_interpolate_variables(self, find_exe, expandv, getenv):
|
def test_interpolate_variables(self, find_exe, expandv, getenv, os_exists):
|
||||||
|
|
||||||
|
os_exists.return_value = True
|
||||||
itrpl = utils.interpolate_variables
|
itrpl = utils.interpolate_variables
|
||||||
|
|
||||||
string = '$CONFIG/../path/to/smth'
|
string = '$CONFIG/../path/to/smth'
|
||||||
@@ -264,3 +266,11 @@ class TestCmdOptions(TestCase):
|
|||||||
'$BASE')
|
'$BASE')
|
||||||
self.assertEqual(itrpl(string, '/home/user/Config.fs-uae', 'base'),
|
self.assertEqual(itrpl(string, '/home/user/Config.fs-uae', 'base'),
|
||||||
'base')
|
'base')
|
||||||
|
|
||||||
|
@mock.patch('os.getenv')
|
||||||
|
@mock.patch('os.path.expandvars')
|
||||||
|
def test_interpolate_variables_path_not_exists(self, expandv, getenv):
|
||||||
|
itrpl = utils.interpolate_variables
|
||||||
|
|
||||||
|
string = '$CONFIG/../path/to/smth'
|
||||||
|
self.assertEqual(itrpl(string, '/home/user/Config.fs-uae'), string)
|
||||||
|
|||||||
15
tox.ini
15
tox.ini
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py27,py34,py27-flake8,py34-flake8
|
envlist = py3,py3-flake8
|
||||||
|
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
|
|
||||||
@@ -10,16 +10,7 @@ commands = py.test --cov=fs_uae_wrapper --cov-report=term-missing
|
|||||||
|
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:py27]
|
[testenv:py3-flake8]
|
||||||
deps = {[testenv]deps}
|
basepython = python3
|
||||||
mock
|
|
||||||
|
|
||||||
[testenv:py34-flake8]
|
|
||||||
basepython = python3.4
|
|
||||||
deps = flake8
|
|
||||||
commands = flake8 {posargs}
|
|
||||||
|
|
||||||
[testenv:py27-flake8]
|
|
||||||
basepython = python2.7
|
|
||||||
deps = flake8
|
deps = flake8
|
||||||
commands = flake8 {posargs}
|
commands = flake8 {posargs}
|
||||||
|
|||||||
Reference in New Issue
Block a user