From 75d2cff96c46257e55fbecfaa50db7c92424b0b7 Mon Sep 17 00:00:00 2001 From: gryf Date: Fri, 2 Sep 2022 18:58:02 +0200 Subject: [PATCH] Drop Python2 support. --- README.rst | 2 +- fs_uae_wrapper/plain.py | 2 -- fs_uae_wrapper/utils.py | 13 +++++-------- fs_uae_wrapper/wrapper.py | 5 ----- setup.cfg | 7 ++----- tox.ini | 11 +---------- 6 files changed, 9 insertions(+), 31 deletions(-) diff --git a/README.rst b/README.rst index 634a637..7e281e6 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,7 @@ preferably in a archive file vs a bunch of files. Requirements ============ -- Python (2 or 3) +- Python 3 - `fs-uae`_ (obviously :) Fs-uae-wrapper supports several types of archives: diff --git a/fs_uae_wrapper/plain.py b/fs_uae_wrapper/plain.py index 3f34b83..c590451 100644 --- a/fs_uae_wrapper/plain.py +++ b/fs_uae_wrapper/plain.py @@ -1,5 +1,3 @@ -#!/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. diff --git a/fs_uae_wrapper/utils.py b/fs_uae_wrapper/utils.py index 1e19dbc..7c5e70a 100644 --- a/fs_uae_wrapper/utils.py +++ b/fs_uae_wrapper/utils.py @@ -1,14 +1,11 @@ """ Misc utilities """ -from distutils import spawn +import configparser import logging import os +import shutil import subprocess -try: - import configparser -except ImportError: - import ConfigParser as configparser from fs_uae_wrapper import message from fs_uae_wrapper import file_archive @@ -46,7 +43,7 @@ class CmdOption(dict): def get_config_options(conf): """Read config file and return options as a dict""" - parser = configparser.SafeConfigParser() + parser = configparser.ConfigParser() try: parser.read(conf) except configparser.ParsingError: @@ -153,10 +150,10 @@ def interpolate_variables(string, config_path, base=None): string = string.replace('$HOME', os.path.expandvars('$HOME')) 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: - string = string.replace('$APP', spawn.find_executable('fs-uae')) + string = string.replace('$APP', shutil.which('fs-uae')) if '$DOCUMENTS' in string: xdg_docs = os.getenv('XDG_DOCUMENTS_DIR', diff --git a/fs_uae_wrapper/wrapper.py b/fs_uae_wrapper/wrapper.py index 2736e94..41d69b4 100644 --- a/fs_uae_wrapper/wrapper.py +++ b/fs_uae_wrapper/wrapper.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """ Wrapper for FS-UAE to perform some actions before and or after running the emulator, if appropriate option is enabled. @@ -119,7 +118,3 @@ def run(): if not exit_code: sys.exit(4) - - -if __name__ == "__main__": - run() diff --git a/setup.cfg b/setup.cfg index 14c3d78..f66a03e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,16 +7,13 @@ author_email = gryf73@gmail.com url = https://github.com/gryf/fs-uea-wrapper license = BSD keywords = uae, fs-uae, amiga, emulator, wrapper -version = 0.8.1 +version = 0.8.2 classifier = Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: End Users/Desktop License :: OSI Approved :: BSD License - Operating System :: POSIX :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 + Operating System :: OS Independent Programming Language :: Python :: 3 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 diff --git a/tox.ini b/tox.ini index 9c0405f..0659f33 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py3,py27-flake8,py3-flake8 +envlist = py3,py3-flake8 usedevelop = True @@ -10,16 +10,7 @@ commands = py.test --cov=fs_uae_wrapper --cov-report=term-missing deps = -r{toxinidir}/test-requirements.txt -[testenv:py27] -deps = {[testenv]deps} - mock - [testenv:py3-flake8] basepython = python3 deps = flake8 commands = flake8 {posargs} - -[testenv:py27-flake8] -basepython = python2.7 -deps = flake8 -commands = flake8 {posargs}