Hello community,
here is the log from the commit of package python-subprocrunner for
openSUSE:Factory checked in at 2020-02-18 10:36:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-subprocrunner (Old)
and /work/SRC/openSUSE:Factory/.python-subprocrunner.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-subprocrunner"
Tue Feb 18 10:36:17 2020 rev:2 rq:774733 version:1.0.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-subprocrunner/python-subprocrunner.changes
2020-02-09 20:47:32.722845144 +0100
+++
/work/SRC/openSUSE:Factory/.python-subprocrunner.new.26092/python-subprocrunner.changes
2020-02-18 10:37:38.536606241 +0100
@@ -1,0 +2,10 @@
+Sun Feb 16 19:32:47 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 1.0.0
+ * Drop Python 2 support
+ * Add type annotations and py.typed to the package
+ * Replace the logging library from Logbook to loguru
+ * Remove deprecated error classes
+ * Remove deprecated methods
+
+-------------------------------------------------------------------
Old:
----
subprocrunner-0.17.2.tar.gz
New:
----
subprocrunner-1.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-subprocrunner.spec ++++++
--- /var/tmp/diff_new_pack.88em4i/_old 2020-02-18 10:37:42.608614549 +0100
+++ /var/tmp/diff_new_pack.88em4i/_new 2020-02-18 10:37:42.612614557 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-subprocrunner
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,12 +12,14 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
Name: python-subprocrunner
-Version: 0.17.2
+Version: 1.0.0
Release: 0
Summary: A Python wrapper library for subprocess module
License: MIT
@@ -28,15 +30,16 @@
BuildRequires: fdupes
BuildRequires: python-rpm-macros
# SECTION test requirements
+BuildRequires: %{python_module loguru}
BuildRequires: %{python_module mbstrdecoder >= 0.8.0}
BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module six}
BuildRequires: %{python_module typepy}
# /SECTION
+Requires: python-loguru
Requires: python-mbstrdecoder >= 0.8.0
Requires: python-six
-Suggests: python-Logbook >= 0.12.3
-Suggests: python-typepy
+Requires: python-typepy
BuildArch: noarch
%python_subpackages
++++++ subprocrunner-0.17.2.tar.gz -> subprocrunner-1.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/PKG-INFO
new/subprocrunner-1.0.0/PKG-INFO
--- old/subprocrunner-0.17.2/PKG-INFO 2020-01-04 16:06:49.580974300 +0100
+++ new/subprocrunner-1.0.0/PKG-INFO 2020-02-11 08:49:07.976968500 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: subprocrunner
-Version: 0.17.2
+Version: 1.0.0
Summary: A Python wrapper library for subprocess module.
Home-page: https://github.com/thombashi/subprocrunner
Author: Tsuyoshi Hombashi
@@ -147,26 +147,24 @@
Dependencies
============
- Python 2.7+ or 3.5+
+ Python 3.5+
- `mbstrdecoder <https://github.com/thombashi/mbstrdecoder>`__
Optional dependencies
----------------------------------
- - `logbook <https://logbook.readthedocs.io/en/stable/>`__
- - Logging using logbook if the package installed
+ - `loguru <https://github.com/Delgan/loguru>`__
+ - Used for logging if the package installed
Test dependencies
-----------------
- `pytest <https://docs.pytest.org/en/latest/>`__
- - `pytest-runner <https://github.com/pytest-dev/pytest-runner>`__
- - `six <https://pypi.org/project/six/>`__
- `tox <https://testrun.org/tox/latest/>`__
- `typepy <https://github.com/thombashi/typepy>`__
Keywords: library,subprocess
Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
@@ -174,18 +172,18 @@
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
-Provides-Extra: dev
+Requires-Python: >=3.5
+Description-Content-Type: text/x-rst
Provides-Extra: logging
Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/README.rst
new/subprocrunner-1.0.0/README.rst
--- old/subprocrunner-0.17.2/README.rst 2020-01-04 15:59:57.000000000 +0100
+++ new/subprocrunner-1.0.0/README.rst 2020-02-11 07:56:06.000000000 +0100
@@ -137,19 +137,17 @@
Dependencies
============
-Python 2.7+ or 3.5+
+Python 3.5+
- `mbstrdecoder <https://github.com/thombashi/mbstrdecoder>`__
Optional dependencies
----------------------------------
-- `logbook <https://logbook.readthedocs.io/en/stable/>`__
- - Logging using logbook if the package installed
+- `loguru <https://github.com/Delgan/loguru>`__
+ - Used for logging if the package installed
Test dependencies
-----------------
- `pytest <https://docs.pytest.org/en/latest/>`__
-- `pytest-runner <https://github.com/pytest-dev/pytest-runner>`__
-- `six <https://pypi.org/project/six/>`__
- `tox <https://testrun.org/tox/latest/>`__
- `typepy <https://github.com/thombashi/typepy>`__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/pyproject.toml
new/subprocrunner-1.0.0/pyproject.toml
--- old/subprocrunner-0.17.2/pyproject.toml 2020-01-04 15:32:52.000000000
+0100
+++ new/subprocrunner-1.0.0/pyproject.toml 2020-02-11 06:26:11.000000000
+0100
@@ -7,6 +7,7 @@
| \.mypy_cache
| \.tox
| \.venv
+ | \.pytype
| _build
| buck-out
| build
@@ -16,9 +17,11 @@
'''
[tool.isort]
-dont_skip = "*/**/__init__.py"
+dont_skip = '*/**/__init__.py'
known_third_party = [
- "readmemaker",
+ 'pytest',
+ 'readmemaker',
+ 'typepy',
]
include_trailing_comma = true
line_length = 100
@@ -26,14 +29,14 @@
multi_line_output = 3
skip_glob = [
'*/.eggs/*',
+ '*/.pytype/*',
'*/.tox/*',
]
[tool.coverage.run]
-source = ["subprocrunner"]
+source = ['subprocrunner']
branch = true
omit = [
- "subprocrunner/_six.py"
]
[tool.coverage.report]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/requirements/docs_requirements.txt
new/subprocrunner-1.0.0/requirements/docs_requirements.txt
--- old/subprocrunner-0.17.2/requirements/docs_requirements.txt 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/requirements/docs_requirements.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-Sphinx
-sphinx_rtd_theme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/requirements/test_requirements.txt
new/subprocrunner-1.0.0/requirements/test_requirements.txt
--- old/subprocrunner-0.17.2/requirements/test_requirements.txt 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/requirements/test_requirements.txt 2020-02-11
06:26:00.000000000 +0100
@@ -1,3 +1,2 @@
pytest
-six
typepy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/setup.cfg
new/subprocrunner-1.0.0/setup.cfg
--- old/subprocrunner-0.17.2/setup.cfg 2020-01-04 16:06:49.580974300 +0100
+++ new/subprocrunner-1.0.0/setup.cfg 2020-02-11 08:49:07.976968500 +0100
@@ -1,9 +1,3 @@
-[aliases]
-test = pytest
-
-[bdist_wheel]
-universal = 1
-
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/setup.py
new/subprocrunner-1.0.0/setup.py
--- old/subprocrunner-0.17.2/setup.py 2020-01-04 15:59:17.000000000 +0100
+++ new/subprocrunner-1.0.0/setup.py 2020-02-11 08:48:35.000000000 +0100
@@ -1,14 +1,10 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import unicode_literals
-import io
import os.path
-import sys
+from typing import Dict, List # noqa
import setuptools
@@ -18,14 +14,10 @@
REQUIREMENT_DIR = "requirements"
ENCODING = "utf8"
-pkg_info = {}
-
+pkg_info = {} # type: Dict[str, str]
-def need_pytest():
- return set(["pytest", "test", "ptr"]).intersection(sys.argv)
-
-def get_release_command_class():
+def get_release_command_class() -> Dict[str, setuptools.Command]:
try:
from releasecmd import ReleaseCommand
except ImportError:
@@ -38,7 +30,7 @@
exec(f.read(), pkg_info)
-with io.open("README.rst", encoding=ENCODING) as fp:
+with open("README.rst", encoding=ENCODING) as fp:
long_description = fp.read()
with open(os.path.join(REQUIREMENT_DIR, "requirements.txt")) as f:
@@ -47,11 +39,8 @@
with open(os.path.join(REQUIREMENT_DIR, "test_requirements.txt")) as f:
tests_requires = [line.strip() for line in f if line.strip()]
-with open(os.path.join(REQUIREMENT_DIR, "docs_requirements.txt")) as f:
- docs_requires = [line.strip() for line in f if line.strip()]
-
SETUPTOOLS_REQUIRES = ["setuptools>=38.3.0"]
-PYTEST_RUNNER_REQUIRES = ["pytest-runner"] if need_pytest() else []
+LOGGING_REQUIRES = ["loguru>=0.4.1,<1"]
setuptools.setup(
name=MODULE_NAME,
@@ -64,22 +53,15 @@
keywords=["library", "subprocess"],
license=pkg_info["__license__"],
long_description=long_description,
+ long_description_content_type="text/x-rst",
packages=setuptools.find_packages(exclude=["test*"]),
+ package_data={"subprocrunner": ["py.typed"]},
project_urls={"Source": REPOSITORY_URL, "Tracker":
"{:s}/issues".format(REPOSITORY_URL)},
- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
+ python_requires=">=3.5",
install_requires=SETUPTOOLS_REQUIRES + install_requires,
- setup_requires=SETUPTOOLS_REQUIRES + PYTEST_RUNNER_REQUIRES,
- tests_require=tests_requires,
- extras_require={
- "dev": ["releasecmd>=0.1.0,<1", "twine", "wheel"]
- + docs_requires
- + ["autoflake", "black", "isort"]
- + ["codespell", "pylama"],
- "logging": ["Logbook>=0.12.3,<2.0.0"],
- "test": tests_requires,
- },
+ extras_require={"logging": LOGGING_REQUIRES, "test": tests_requires +
LOGGING_REQUIRES},
classifiers=[
- "Development Status :: 4 - Beta",
+ "Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
@@ -87,13 +69,13 @@
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner/__init__.py
new/subprocrunner-1.0.0/subprocrunner/__init__.py
--- old/subprocrunner-0.17.2/subprocrunner/__init__.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/__init__.py 2020-02-11
06:33:44.000000000 +0100
@@ -1,13 +1,10 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import
from .__version__ import __author__, __copyright__, __email__, __license__,
__version__
from ._logger import set_log_level, set_logger
from ._subprocess_runner import SubprocessRunner
from ._which import Which
-from .error import CalledProcessError, CommandError, CommandNotFoundError,
InvalidCommandError
+from .error import CalledProcessError, CommandError
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner/__version__.py
new/subprocrunner-1.0.0/subprocrunner/__version__.py
--- old/subprocrunner-0.17.2/subprocrunner/__version__.py 2020-01-04
16:04:05.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/__version__.py 2020-02-11
08:08:17.000000000 +0100
@@ -1,11 +1,6 @@
-# encoding: utf-8
-
-from datetime import datetime
-
-
__author__ = "Tsuyoshi Hombashi"
-__copyright__ = "Copyright 2016-{}, {}".format(datetime.now().year, __author__)
+__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
-__version__ = "0.17.2"
+__version__ = "1.0.0"
__maintainer__ = __author__
__email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner/_logger/__init__.py
new/subprocrunner-1.0.0/subprocrunner/_logger/__init__.py
--- old/subprocrunner-0.17.2/subprocrunner/_logger/__init__.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_logger/__init__.py 2020-02-11
06:20:02.000000000 +0100
@@ -1,5 +1 @@
-# encoding: utf-8
-
-from __future__ import absolute_import
-
from ._logger import DEFAULT_ERROR_LOG_LEVEL, get_logging_method,
set_log_level, set_logger
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner/_logger/_logger.py
new/subprocrunner-1.0.0/subprocrunner/_logger/_logger.py
--- old/subprocrunner-0.17.2/subprocrunner/_logger/_logger.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_logger/_logger.py 2020-02-11
06:29:36.000000000 +0100
@@ -1,48 +1,40 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, unicode_literals
+
+from typing import Callable, Optional
from ._null_logger import NullLogger
-def _disable_logger(l):
- try:
- l.disable()
- except AttributeError:
- l.disabled = True # to support Logbook<1.0.0
+MODULE_NAME = "subprocrunner"
+DEFAULT_ERROR_LOG_LEVEL = "WARNING"
try:
- import logbook
+ from loguru import logger
- logger = logbook.Logger("subprocrunner")
- _disable_logger(logger)
- LOGBOOK_INSTALLED = True
- DEFAULT_ERROR_LOG_LEVEL = logbook.WARNING
+ LOGURU_INSTALLED = True
+ logger.disable(MODULE_NAME)
except ImportError:
- logger = NullLogger()
- LOGBOOK_INSTALLED = False
- DEFAULT_ERROR_LOG_LEVEL = 13
+ LOGURU_INSTALLED = False
+ logger = NullLogger() # type: ignore
-def get_logging_method(log_level=None):
- if not LOGBOOK_INSTALLED:
+def get_logging_method(log_level: Optional[str] = None) -> Callable:
+ if not LOGURU_INSTALLED:
return logger.debug
if log_level is None:
- log_level = logbook.DEBUG
+ log_level = "DEBUG"
method_table = {
- logbook.NOTSET: lambda _x: None,
- logbook.DEBUG: logger.debug,
- logbook.INFO: logger.info,
- logbook.WARNING: logger.warning,
- logbook.ERROR: logger.error,
- logbook.CRITICAL: logger.critical,
+ "DEBUG": logger.debug,
+ "INFO": logger.info,
+ "WARNING": logger.warning,
+ "ERROR": logger.error,
+ "CRITICAL": logger.critical,
}
method = method_table.get(log_level)
@@ -52,40 +44,13 @@
return method
-def set_logger(is_enable):
- if not LOGBOOK_INSTALLED:
- return
-
+def set_logger(is_enable: bool, propagation_depth: int = 1) -> None:
if is_enable:
- try:
- logger.enable()
- except AttributeError:
- logger.disabled = False # to support Logbook<1.0.0
+ logger.enable(MODULE_NAME)
else:
- _disable_logger(logger)
+ logger.disable(MODULE_NAME)
def set_log_level(log_level):
- """
- Set logging level of this module. Using
- `logbook <https://logbook.readthedocs.io/en/stable/>`__ module for logging.
-
- :param int log_level:
- One of the log level of
- `logbook <https://logbook.readthedocs.io/en/stable/api/base.html>`__.
- Disabled logging if ``log_level`` is ``logbook.NOTSET``.
- :raises LookupError: If ``log_level`` is an invalid value.
- """
-
- if not LOGBOOK_INSTALLED:
- return
-
- # validate log level
- logbook.get_level_name(log_level)
-
- if log_level == logbook.NOTSET:
- set_logger(is_enable=False)
- else:
- set_logger(is_enable=True)
-
- logger.level = log_level
+ # deprecated
+ return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner/_logger/_null_logger.py
new/subprocrunner-1.0.0/subprocrunner/_logger/_null_logger.py
--- old/subprocrunner-0.17.2/subprocrunner/_logger/_null_logger.py
2019-12-30 00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_logger/_null_logger.py
2020-02-11 06:20:02.000000000 +0100
@@ -1,7 +1,4 @@
-# encoding: utf-8
-
-
-class NullLogger(object):
+class NullLogger:
level_name = None
def catch_exceptions(self, *args, **kwargs): # pragma: no cover
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner/_six.py
new/subprocrunner-1.0.0/subprocrunner/_six.py
--- old/subprocrunner-0.17.2/subprocrunner/_six.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_six.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-# encoding: utf-8
-
-"""
-source code from six: https://github.com/benjaminp/six/blob/master/LICENSE
-"""
-
-from __future__ import absolute_import
-
-import sys
-
-
-# Useful for very coarse version differentiation.
-PY2 = sys.version_info[0] == 2
-PY3 = sys.version_info[0] == 3
-
-
-if PY3:
- text_type = str
-else:
- text_type = unicode
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner/_subprocess_runner.py
new/subprocrunner-1.0.0/subprocrunner/_subprocess_runner.py
--- old/subprocrunner-0.17.2/subprocrunner/_subprocess_runner.py
2019-12-30 00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_subprocess_runner.py 2020-02-11
07:49:50.000000000 +0100
@@ -1,10 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, unicode_literals
import errno
import os
@@ -12,16 +9,19 @@
import subprocess
import traceback
from subprocess import PIPE
+from typing import Dict, List, Optional, Pattern, Sequence, Union, cast
from mbstrdecoder import MultiByteStrDecoder
from ._logger import DEFAULT_ERROR_LOG_LEVEL, get_logging_method
-from ._six import text_type
from ._which import Which
from .error import CalledProcessError, CommandError
-class SubprocessRunner(object):
+Command = Union[str, Sequence[str]]
+
+
+class SubprocessRunner:
"""
.. py:attribute:: default_is_dry_run
@@ -43,58 +43,31 @@
is_save_history = False
history_size = 512
- __command_history = []
+ __command_history = [] # type: List[Command]
@classmethod
- def get_history(cls):
+ def get_history(cls) -> List[Command]:
return cls.__command_history
@classmethod
- def clear_history(cls):
+ def clear_history(cls) -> None:
cls.__command_history = []
- @property
- def dry_run(self):
- return self.__dry_run
-
- @property
- def command(self):
- return self.__command
-
- @property
- def command_str(self):
- if self.__is_shell:
- return self.__command
-
- return " ".join(self.__command)
-
- @property
- def stdout(self):
- return self.__stdout
-
- @property
- def stderr(self):
- return self.__stderr
-
- @property
- def returncode(self):
- return self.__returncode
-
- @property
- def error_log_level(self):
- raise NotImplementedError()
-
- @error_log_level.setter
- def error_log_level(self, log_level):
- self.__error_logging_method = get_logging_method(log_level)
+ def __init__(
+ self,
+ command: Command,
+ error_log_level: None = None,
+ ignore_stderr_regexp: Optional[Pattern] = None,
+ dry_run: Optional[bool] = None,
+ ) -> None:
+ self.__command = [] # type: Union[str, Sequence[str]]
- def __init__(self, command, error_log_level=None,
ignore_stderr_regexp=None, dry_run=None):
if not command:
raise ValueError("command is empty")
if isinstance(command, (list, tuple)):
self.__is_shell = False
- self.__command = [text_type(item) for item in command]
+ self.__command = [str(item) for item in command]
else:
self.__is_shell = True
self.__command = command
@@ -103,8 +76,8 @@
self.__dry_run = dry_run
else:
self.__dry_run = self.default_is_dry_run
- self.__stdout = None
- self.__stderr = None
+ self.__stdout = None # type: Union[str, bytes, None]
+ self.__stderr = None # type: Union[str, bytes, None]
self.__returncode = None
self.__ignore_stderr_regexp = ignore_stderr_regexp
@@ -121,7 +94,42 @@
self.__command_history.append(command)
- def run(self, **kwargs):
+ @property
+ def dry_run(self) -> bool:
+ return self.__dry_run
+
+ @property
+ def command(self) -> Command:
+ return self.__command
+
+ @property
+ def command_str(self) -> str:
+ if self.__is_shell:
+ return cast(str, self.__command)
+
+ return " ".join(self.__command)
+
+ @property
+ def stdout(self) -> Union[str, bytes, None]:
+ return self.__stdout
+
+ @property
+ def stderr(self) -> Union[str, bytes, None]:
+ return self.__stderr
+
+ @property
+ def returncode(self) -> Optional[int]:
+ return self.__returncode
+
+ @property
+ def error_log_level(self):
+ raise NotImplementedError()
+
+ @error_log_level.setter
+ def error_log_level(self, log_level):
+ self.__error_logging_method = get_logging_method(log_level)
+
+ def run(self, **kwargs) -> Optional[int]:
self.__verify_command()
check = kwargs.pop("check", None)
@@ -162,7 +170,10 @@
return 0
try:
- if self.__ignore_stderr_regexp.search(self.stderr) is not None:
+ if (
+ self.__ignore_stderr_regexp
+ and self.__ignore_stderr_regexp.search(self.stderr) is not None
+ ):
return self.returncode
except AttributeError:
pass
@@ -176,15 +187,17 @@
stderr=self.stderr,
)
+ # pytype: disable=attribute-error
self.__error_logging_method(
- "command='{}', returncode={}, stderr={}".format(
+ "command='{}', returncode={}, stderr={!r}".format(
self.command, self.returncode, self.stderr
)
)
+ # pytype: enable=attribute-error
return self.returncode
- def popen(self, std_in=None, env=None):
+ def popen(self, std_in: Optional[int] = None, env: Optional[Dict[str,
str]] = None):
self.__verify_command()
if self.dry_run:
@@ -226,7 +239,7 @@
return
if self.__is_shell:
- base_command = self.command.split()[0].lstrip("(")
+ base_command = cast(str, self.command).split()[0].lstrip("(")
else:
base_command = self.command[0]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner/_which.py
new/subprocrunner-1.0.0/subprocrunner/_which.py
--- old/subprocrunner-0.17.2/subprocrunner/_which.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/_which.py 2020-02-11
07:49:50.000000000 +0100
@@ -1,34 +1,30 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, unicode_literals
import errno
import shutil
-import warnings
+from typing import Optional
-from ._six import PY2
from .error import CommandError
-class Which(object):
+class Which:
@property
def command(self):
return self.__command
- def __init__(self, command):
+ def __init__(self, command: str) -> None:
if not command:
raise CommandError(
"invalid command {}: ".format(command), cmd=command,
errno=errno.EINVAL
)
self.__command = command
- self.__abspath = None
+ self.__abspath = None # type: Optional[str]
- def __repr__(self):
+ def __repr__(self) -> str:
item_list = ["command={}".format(self.command),
"is_exist={}".format(self.is_exist())]
if self.is_exist():
@@ -36,36 +32,19 @@
return ", ".join(item_list)
- def is_exist(self):
+ def is_exist(self) -> bool:
return self.abspath() is not None
- def verify(self):
+ def verify(self) -> None:
if not self.is_exist():
raise CommandError(
"command not found: '{}'".format(self.command),
cmd=self.command, errno=errno.ENOENT
)
- def abspath(self):
+ def abspath(self) -> Optional[str]:
if self.__abspath:
return self.__abspath
- if PY2:
- from distutils.spawn import find_executable
-
- self.__abspath = find_executable(self.command)
- else:
- self.__abspath = shutil.which(self.command)
+ self.__abspath = shutil.which(self.command)
return self.__abspath
-
- def full_path(self):
- warnings.warn(
- "full_path() deleted in the future, use abspath() instead.",
DeprecationWarning
- )
-
- return self.abspath()
-
- def which(self):
- warnings.warn("which() deleted in the future, use abspath() instead.",
DeprecationWarning)
-
- return self.abspath()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner/error.py
new/subprocrunner-1.0.0/subprocrunner/error.py
--- old/subprocrunner-0.17.2/subprocrunner/error.py 2019-12-30
00:54:16.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner/error.py 2020-02-11
07:45:41.000000000 +0100
@@ -1,10 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, unicode_literals
import subprocess
import sys
@@ -19,28 +16,18 @@
def errno(self):
return self.__errno
- def __init__(self, *args, **kwargs):
+ def __init__(self, *args, **kwargs) -> None:
self.__cmd = kwargs.pop("cmd", None)
self.__errno = kwargs.pop("errno", None)
- super(CommandError, self).__init__(*args, **kwargs)
+ super().__init__(*args)
class CalledProcessError(subprocess.CalledProcessError):
- def __init__(self, *args, **kwargs):
+ def __init__(self, *args, **kwargs) -> None:
if sys.version_info[0:2] <= (3, 4):
# stdout and stderr attribute added to
subprocess.CalledProcessError since Python 3.5
self.stdout = kwargs.pop("stdout", None)
self.stderr = kwargs.pop("stderr", None)
- super(CalledProcessError, self).__init__(*args, **kwargs)
-
-
-class InvalidCommandError(CommandError):
- # Deprecate in the future
- pass
-
-
-class CommandNotFoundError(CommandError):
- # Deprecate in the future
- pass
+ super().__init__(*args, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/subprocrunner.egg-info/PKG-INFO
new/subprocrunner-1.0.0/subprocrunner.egg-info/PKG-INFO
--- old/subprocrunner-0.17.2/subprocrunner.egg-info/PKG-INFO 2020-01-04
16:06:49.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner.egg-info/PKG-INFO 2020-02-11
08:49:07.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: subprocrunner
-Version: 0.17.2
+Version: 1.0.0
Summary: A Python wrapper library for subprocess module.
Home-page: https://github.com/thombashi/subprocrunner
Author: Tsuyoshi Hombashi
@@ -147,26 +147,24 @@
Dependencies
============
- Python 2.7+ or 3.5+
+ Python 3.5+
- `mbstrdecoder <https://github.com/thombashi/mbstrdecoder>`__
Optional dependencies
----------------------------------
- - `logbook <https://logbook.readthedocs.io/en/stable/>`__
- - Logging using logbook if the package installed
+ - `loguru <https://github.com/Delgan/loguru>`__
+ - Used for logging if the package installed
Test dependencies
-----------------
- `pytest <https://docs.pytest.org/en/latest/>`__
- - `pytest-runner <https://github.com/pytest-dev/pytest-runner>`__
- - `six <https://pypi.org/project/six/>`__
- `tox <https://testrun.org/tox/latest/>`__
- `typepy <https://github.com/thombashi/typepy>`__
Keywords: library,subprocess
Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
+Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
@@ -174,18 +172,18 @@
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
-Provides-Extra: dev
+Requires-Python: >=3.5
+Description-Content-Type: text/x-rst
Provides-Extra: logging
Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner.egg-info/SOURCES.txt
new/subprocrunner-1.0.0/subprocrunner.egg-info/SOURCES.txt
--- old/subprocrunner-0.17.2/subprocrunner.egg-info/SOURCES.txt 2020-01-04
16:06:49.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner.egg-info/SOURCES.txt 2020-02-11
08:49:07.000000000 +0100
@@ -2,15 +2,12 @@
MANIFEST.in
README.rst
pyproject.toml
-setup.cfg
setup.py
tox.ini
-requirements/docs_requirements.txt
requirements/requirements.txt
requirements/test_requirements.txt
subprocrunner/__init__.py
subprocrunner/__version__.py
-subprocrunner/_six.py
subprocrunner/_subprocess_runner.py
subprocrunner/_which.py
subprocrunner/error.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-0.17.2/subprocrunner.egg-info/requires.txt
new/subprocrunner-1.0.0/subprocrunner.egg-info/requires.txt
--- old/subprocrunner-0.17.2/subprocrunner.egg-info/requires.txt
2020-01-04 16:06:49.000000000 +0100
+++ new/subprocrunner-1.0.0/subprocrunner.egg-info/requires.txt 2020-02-11
08:49:07.000000000 +0100
@@ -1,22 +1,10 @@
setuptools>=38.3.0
mbstrdecoder<1.0.0,>=0.8.3
-[dev]
-releasecmd<1,>=0.1.0
-twine
-wheel
-Sphinx
-sphinx_rtd_theme
-autoflake
-black
-isort
-codespell
-pylama
-
[logging]
-Logbook<2.0.0,>=0.12.3
+loguru<1,>=0.4.1
[test]
pytest
-six
typepy
+loguru<1,>=0.4.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/test/test_logger.py
new/subprocrunner-1.0.0/test/test_logger.py
--- old/subprocrunner-0.17.2/test/test_logger.py 2020-01-04
15:50:25.000000000 +0100
+++ new/subprocrunner-1.0.0/test/test_logger.py 2020-02-11 06:20:02.000000000
+0100
@@ -1,47 +1,14 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import print_function, unicode_literals
import pytest
-from subprocrunner import set_log_level, set_logger
-
-
-logbook = pytest.importorskip("logbook", minversion="0.12.3")
-
-import logbook # isort:skip
+from subprocrunner import set_logger
-class Test_set_logger(object):
+class Test_set_logger:
@pytest.mark.parametrize(["value"], [[True], [False]])
def test_smoke(self, value):
set_logger(value)
-
-
-class Test_set_log_level(object):
- @pytest.mark.parametrize(
- ["value"],
- [
- [logbook.CRITICAL],
- [logbook.ERROR],
- [logbook.WARNING],
- [logbook.NOTICE],
- [logbook.INFO],
- [logbook.DEBUG],
- [logbook.TRACE],
- [logbook.NOTSET],
- ],
- )
- def test_smoke(self, value):
- set_log_level(value)
-
- @pytest.mark.parametrize(
- ["value", "expected"], [[None, LookupError], ["unexpected",
LookupError]]
- )
- def test_exception(self, value, expected):
- with pytest.raises(expected):
- set_log_level(value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/test/test_subproc_runner.py
new/subprocrunner-1.0.0/test/test_subproc_runner.py
--- old/subprocrunner-0.17.2/test/test_subproc_runner.py 2020-01-04
15:50:25.000000000 +0100
+++ new/subprocrunner-1.0.0/test/test_subproc_runner.py 2020-02-11
06:20:14.000000000 +0100
@@ -1,10 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import print_function, unicode_literals
import errno
import os
@@ -15,7 +12,6 @@
from subprocess import PIPE, CalledProcessError
import pytest
-import six
from typepy import is_not_null_string, is_null_string
from subprocrunner import SubprocessRunner
@@ -35,7 +31,7 @@
raise NotImplementedError(os_type)
-class Test_SubprocessRunner_run(object):
+class Test_SubprocessRunner_run:
@pytest.mark.parametrize(
["command", "dry_run", "expected"],
[
@@ -69,7 +65,7 @@
runner.run()
assert runner.command == command
- assert isinstance(runner.command_str, six.string_types)
+ assert isinstance(runner.command_str, str)
assert runner.returncode == 0
assert runner.stdout.strip() == expected
assert is_null_string(runner.stderr)
@@ -88,13 +84,13 @@
],
)
def test_stderr(self, capsys, command, ignore_stderr_regexp, out_regexp,
expected):
- logbook = pytest.importorskip("logbook", minversion="0.12.3")
-
- import logbook
+ from loguru import logger
import subprocrunner
- logbook.StderrHandler(level=logbook.DEBUG).push_application()
- subprocrunner.set_log_level(logbook.INFO)
+ logger.remove()
+ logger.add(sys.stderr, level="DEBUG")
+ logger.enable("test")
+ subprocrunner.set_logger(True)
runner = SubprocessRunner(command,
ignore_stderr_regexp=ignore_stderr_regexp)
runner.run()
@@ -139,7 +135,7 @@
runner.run()
-class Test_SubprocessRunner_popen(object):
+class Test_SubprocessRunner_popen:
@pytest.mark.parametrize(
["command", "environ", "expected"],
[["hostname", None, 0], ["hostname", dict(os.environ), 0]],
@@ -152,7 +148,7 @@
assert proc.returncode == expected
@pytest.mark.skipif("platform.system() == 'Windows'")
- @pytest.mark.parametrize(["command", "pipe_input", "expected"], [["grep
a", six.b("aaa"), 0]])
+ @pytest.mark.parametrize(["command", "pipe_input", "expected"], [["grep
a", b"aaa", 0]])
def test_normal_stdin(self, command, pipe_input, expected):
proc = SubprocessRunner(command).popen(PIPE)
ret_stdout, ret_stderr = proc.communicate(input=pipe_input)
@@ -162,7 +158,7 @@
assert proc.returncode == expected
-class Test_SubprocessRunner_command_history(object):
+class Test_SubprocessRunner_command_history:
@pytest.mark.parametrize(
["command", "dry_run", "expected"], [[list_command, False, 0],
[list_command, True, 0]]
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/test/test_which.py
new/subprocrunner-1.0.0/test/test_which.py
--- old/subprocrunner-0.17.2/test/test_which.py 2020-01-04 15:50:25.000000000
+0100
+++ new/subprocrunner-1.0.0/test/test_which.py 2020-02-11 06:20:02.000000000
+0100
@@ -1,10 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import unicode_literals
import platform # noqa: W0611
import re
@@ -16,7 +13,7 @@
from subprocrunner import Which
-class Test_Which_constructor(object):
+class Test_Which_constructor:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -30,7 +27,7 @@
Which(value)
-class Test_Which_repr(object):
+class Test_Which_repr:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.parametrize(
["value", "expected_regexp"],
@@ -46,7 +43,7 @@
assert expected_regexp.search(str(Which(value))) is not None
-class Test_Which_is_exist(object):
+class Test_Which_is_exist:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.parametrize(
["value", "expected"], [["ls", True], ["/bin/ls", True],
["__not_exist_command__", False]]
@@ -63,7 +60,7 @@
assert which.is_exist() == expected
-class Test_Which_verify(object):
+class Test_Which_verify:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.parametrize(["value"], [["ls"]])
def test_normal_linux(self, value):
@@ -82,7 +79,7 @@
Which(value).verify()
-class Test_Which_abspath(object):
+class Test_Which_abspath:
@pytest.mark.skipif("platform.system() == 'Windows'")
@pytest.mark.parametrize(["value"], [["ls"]])
def test_normal_linux(self, value):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-0.17.2/tox.ini
new/subprocrunner-1.0.0/tox.ini
--- old/subprocrunner-0.17.2/tox.ini 2020-01-04 15:23:36.000000000 +0100
+++ new/subprocrunner-1.0.0/tox.ini 2020-02-11 08:03:08.000000000 +0100
@@ -1,18 +1,73 @@
[tox]
-envlist = py{27,35,36,37,38},pypy3,cov
+envlist =
+ py{35,36,37,38,py39}
+ pypy3
+ build
+ clean
+ cov
+ fmt
+ lint
+ release
[testenv]
deps =
.[test]
commands =
- python setup.py test
+ pytest
+
+[testenv:build]
+basepython = python3.8
+deps =
+ twine
+ wheel
+commands =
+ python setup.py sdist bdist_wheel
+ twine check dist/*
+ python setup.py clean --all
+
+[testenv:clean]
+basepython = python3.8
+deps =
+ cleanpy
+commands =
+ cleanpy --all .
[testenv:cov]
-autoupgrade_pip = true
deps =
.[test]
coverage[toml]
- coveralls
pytest-cov
commands =
- python setup.py test --addopts "-v --cov"
+ pytest -vv --cov
+
+[testenv:fmt]
+basepython = python3.8
+deps =
+ autoflake
+ black
+ isort
+commands =
+ autoflake --in-place --recursive --remove-all-unused-imports
--ignore-init-module-imports --exclude ".pytype" .
+ isort --apply --recursive
+ black setup.py examples test subprocrunner
+
+[testenv:lint]
+basepython = python3.7
+deps =
+ codespell
+ mypy
+ pylama
+ pytype
+commands =
+ python setup.py check
+ mypy subprocrunner --ignore-missing-imports --show-error-context
--show-error-codes --python-version 3.6
+ pytype --disable import-error subprocrunner
+ codespell subprocrunner examples test README.rst -q 2 --check-filenames
+ pylama
+
+[testenv:release]
+basepython = python3.7
+deps =
+ releasecmd>=0.2.0
+commands =
+ python setup.py release --sign