Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-subprocrunner for
openSUSE:Factory checked in at 2024-04-21 20:26:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-subprocrunner (Old)
and /work/SRC/openSUSE:Factory/.python-subprocrunner.new.26366 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-subprocrunner"
Sun Apr 21 20:26:39 2024 rev:11 rq:1169319 version:2.0.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-subprocrunner/python-subprocrunner.changes
2022-11-12 17:41:36.678325925 +0100
+++
/work/SRC/openSUSE:Factory/.python-subprocrunner.new.26366/python-subprocrunner.changes
2024-04-21 20:27:52.079213480 +0200
@@ -1,0 +2,10 @@
+Sat Apr 20 07:45:10 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 2.0.1:
+ * Add `__all__` to `__init__.py`
+ * Update the package metadata
+ * Drop support for Python 3.6
+ * Add support for Python 3.11 and 3.12
+ * Fix type annotations
+
+-------------------------------------------------------------------
Old:
----
subprocrunner-2.0.0.tar.gz
New:
----
subprocrunner-2.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-subprocrunner.spec ++++++
--- /var/tmp/diff_new_pack.uWyo2E/_old 2024-04-21 20:27:52.599232561 +0200
+++ /var/tmp/diff_new_pack.uWyo2E/_new 2024-04-21 20:27:52.603232708 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-subprocrunner
#
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%define skip_python2 1
Name: python-subprocrunner
-Version: 2.0.0
+Version: 2.0.1
Release: 0
Summary: A Python wrapper library for subprocess module
License: MIT
++++++ subprocrunner-2.0.0.tar.gz -> subprocrunner-2.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/MANIFEST.in
new/subprocrunner-2.0.1/MANIFEST.in
--- old/subprocrunner-2.0.0/MANIFEST.in 2022-01-15 13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/MANIFEST.in 2024-04-06 18:02:01.000000000 +0200
@@ -1,6 +1,5 @@
include LICENSE
include README.rst
-include setup.cfg
include tox.ini
include */py.typed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/PKG-INFO
new/subprocrunner-2.0.1/PKG-INFO
--- old/subprocrunner-2.0.0/PKG-INFO 2022-01-15 13:56:57.050000000 +0100
+++ new/subprocrunner-2.0.1/PKG-INFO 2024-04-06 18:02:25.845052700 +0200
@@ -1,15 +1,15 @@
Metadata-Version: 2.1
Name: subprocrunner
-Version: 2.0.0
+Version: 2.0.1
Summary: A Python wrapper library for subprocess module.
Home-page: https://github.com/thombashi/subprocrunner
Author: Tsuyoshi Hombashi
Author-email: [email protected]
License: MIT License
+Project-URL: Changlog, https://github.com/thombashi/subprocrunner/releases
Project-URL: Source, https://github.com/thombashi/subprocrunner
Project-URL: Tracker, https://github.com/thombashi/subprocrunner/issues
Keywords: library,subprocess
-Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
@@ -19,21 +19,29 @@
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
-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.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
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: >=3.6
+Classifier: Typing :: Typed
+Requires-Python: >=3.7
Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: mbstrdecoder<2,>=1.0.0
Provides-Extra: logging
+Requires-Dist: loguru<1,>=0.4.1; extra == "logging"
Provides-Extra: test
-License-File: LICENSE
+Requires-Dist: pytest; extra == "test"
+Requires-Dist: pytest-mock; extra == "test"
+Requires-Dist: typepy; extra == "test"
+Requires-Dist: loguru<1,>=0.4.1; extra == "test"
.. contents:: **subprocrunner**
:backlinks: top
@@ -44,26 +52,32 @@
=============
A Python wrapper library for ``subprocess`` module.
-.. image:: https://badge.fury.io/py/subprocrunner.svg
+|PyPI pkg ver| |Supported Python versions| |Supported Python implementations|
|CI status| |Test coverage| |CodeQL|
+
+.. |PyPI pkg ver| image:: https://badge.fury.io/py/subprocrunner.svg
:target: https://badge.fury.io/py/subprocrunner
:alt: PyPI package version
-.. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
+.. |Supported Python versions| image::
https://img.shields.io/pypi/pyversions/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python versions
-.. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
+.. |Supported Python implementations| image::
https://img.shields.io/pypi/implementation/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python implementations
-.. image::
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
- :target:
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+.. |CI status| image::
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml
:alt: CI status of Linux/macOS/Windows
-.. image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
+.. |Test coverage| image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
:alt: Test coverage
+.. |CodeQL| image::
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql
+ :alt: CodeQL
+
Usage
========
@@ -95,7 +109,7 @@
return code: 2
stderr: ls: cannot access '__not_exist_dir__': No such file or
directory
-Execute a command with retry
+Execute a command with retries
--------------------------------------------------------
:Sample Code:
@@ -215,12 +229,10 @@
Dependencies
============
-- Python 3.6+
+- Python 3.7+
- `Python package dependencies (automatically installed)
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
Optional dependencies
----------------------------------
- `loguru <https://github.com/Delgan/loguru>`__
- Used for logging if the package installed
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/README.rst
new/subprocrunner-2.0.1/README.rst
--- old/subprocrunner-2.0.0/README.rst 2022-01-15 13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/README.rst 2024-04-06 18:02:01.000000000 +0200
@@ -7,26 +7,32 @@
=============
A Python wrapper library for ``subprocess`` module.
-.. image:: https://badge.fury.io/py/subprocrunner.svg
+|PyPI pkg ver| |Supported Python versions| |Supported Python implementations|
|CI status| |Test coverage| |CodeQL|
+
+.. |PyPI pkg ver| image:: https://badge.fury.io/py/subprocrunner.svg
:target: https://badge.fury.io/py/subprocrunner
:alt: PyPI package version
-.. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
+.. |Supported Python versions| image::
https://img.shields.io/pypi/pyversions/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python versions
-.. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
+.. |Supported Python implementations| image::
https://img.shields.io/pypi/implementation/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python implementations
-.. image::
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
- :target:
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+.. |CI status| image::
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml
:alt: CI status of Linux/macOS/Windows
-.. image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
+.. |Test coverage| image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
:alt: Test coverage
+.. |CodeQL| image::
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql
+ :alt: CodeQL
+
Usage
========
@@ -58,7 +64,7 @@
return code: 2
stderr: ls: cannot access '__not_exist_dir__': No such file or
directory
-Execute a command with retry
+Execute a command with retries
--------------------------------------------------------
:Sample Code:
@@ -178,7 +184,7 @@
Dependencies
============
-- Python 3.6+
+- Python 3.7+
- `Python package dependencies (automatically installed)
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
Optional dependencies
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/pyproject.toml
new/subprocrunner-2.0.1/pyproject.toml
--- old/subprocrunner-2.0.0/pyproject.toml 2022-01-15 13:56:25.000000000
+0100
+++ new/subprocrunner-2.0.1/pyproject.toml 2024-04-06 18:02:01.000000000
+0200
@@ -1,5 +1,6 @@
[build-system]
-requires = ["setuptools", "wheel"]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
[tool.black]
line-length = 100
@@ -18,6 +19,7 @@
)/
| docs/conf.py
'''
+target-version = ['py37', 'py38', 'py39', 'py310', 'py311', 'py312']
[tool.isort]
known_third_party = [
@@ -54,3 +56,39 @@
'abstractclassmethod',
'warnings.warn',
]
+
+[tool.mypy]
+ignore_missing_imports = true
+python_version = "3.7"
+
+pretty = true
+
+check_untyped_defs = true
+show_error_codes = true
+show_error_context = true
+warn_unreachable = true
+warn_unused_configs = true
+
+[tool.pyright]
+exclude = [
+ "**/node_modules",
+ "**/__pycache__",
+ ".tox",
+ ".venv",
+ "_build",
+ "_sandbox",
+ "build",
+ "dist"
+]
+pythonVersion = "3.7"
+
+[tool.ruff]
+line-length = 100
+target-version = "py37"
+exclude = [
+ ".eggs/",
+ ".tox/",
+ "_sandbox/*",
+ "build/",
+ "docs/conf.py",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/setup.py
new/subprocrunner-2.0.1/setup.py
--- old/subprocrunner-2.0.0/setup.py 2022-01-15 13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/setup.py 2024-04-06 18:02:01.000000000 +0200
@@ -3,7 +3,7 @@
"""
import os.path
-from typing import Dict
+from typing import Dict, Type
import setuptools
@@ -16,7 +16,7 @@
pkg_info: Dict[str, str] = {}
-def get_release_command_class() -> Dict[str, setuptools.Command]:
+def get_release_command_class() -> Dict[str, Type[setuptools.Command]]:
try:
from releasecmd import ReleaseCommand
except ImportError:
@@ -55,12 +55,16 @@
packages=setuptools.find_packages(exclude=["test*"]),
package_data={MODULE_NAME: ["py.typed"]},
project_urls={
+ "Changlog": f"{REPOSITORY_URL:s}/releases",
"Source": REPOSITORY_URL,
"Tracker": f"{REPOSITORY_URL:s}/issues",
},
- python_requires=">=3.6",
+ python_requires=">=3.7",
install_requires=install_requires,
- extras_require={"logging": LOGGING_REQUIRES, "test": tests_requires +
LOGGING_REQUIRES},
+ extras_require={
+ "logging": LOGGING_REQUIRES,
+ "test": tests_requires + LOGGING_REQUIRES,
+ },
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
@@ -71,16 +75,18 @@
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
+ "Typing :: Typed",
],
cmdclass=get_release_command_class(),
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner/__init__.py
new/subprocrunner-2.0.1/subprocrunner/__init__.py
--- old/subprocrunner-2.0.0/subprocrunner/__init__.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/__init__.py 2024-04-06
18:02:01.000000000 +0200
@@ -2,10 +2,25 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
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
from .retry import Retry
+
+
+__all__ = (
+ "__author__",
+ "__copyright__",
+ "__email__",
+ "__license__",
+ "__version__",
+ "CalledProcessError",
+ "CommandError",
+ "Retry",
+ "SubprocessRunner",
+ "Which",
+ "set_log_level",
+ "set_logger",
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner/__version__.py
new/subprocrunner-2.0.1/subprocrunner/__version__.py
--- old/subprocrunner-2.0.0/subprocrunner/__version__.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/__version__.py 2024-04-06
18:02:01.000000000 +0200
@@ -1,6 +1,6 @@
__author__ = "Tsuyoshi Hombashi"
__copyright__ = f"Copyright 2016, {__author__}"
__license__ = "MIT License"
-__version__ = "2.0.0"
+__version__ = "2.0.1"
__maintainer__ = __author__
__email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-2.0.0/subprocrunner/_logger/__init__.py
new/subprocrunner-2.0.1/subprocrunner/_logger/__init__.py
--- old/subprocrunner-2.0.0/subprocrunner/_logger/__init__.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/_logger/__init__.py 2024-04-06
18:02:01.000000000 +0200
@@ -1 +1,9 @@
from ._logger import DEFAULT_ERROR_LOG_LEVEL, get_logging_method,
set_log_level, set_logger
+
+
+__all__ = [
+ "DEFAULT_ERROR_LOG_LEVEL",
+ "get_logging_method",
+ "set_log_level",
+ "set_logger",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner/_logger/_logger.py
new/subprocrunner-2.0.1/subprocrunner/_logger/_logger.py
--- old/subprocrunner-2.0.0/subprocrunner/_logger/_logger.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/_logger/_logger.py 2024-04-06
18:02:01.000000000 +0200
@@ -2,7 +2,6 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
from typing import Callable, Optional
from ._null_logger import NullLogger
@@ -19,7 +18,7 @@
logger.disable(MODULE_NAME)
except ImportError:
LOGURU_INSTALLED = False
- logger = NullLogger() # type: ignore
+ logger = NullLogger()
def get_logging_method(log_level: Optional[str] = None) -> Callable:
@@ -55,6 +54,6 @@
logger.disable(MODULE_NAME)
-def set_log_level(log_level):
+def set_log_level(log_level): # type: ignore
# deprecated
return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-2.0.0/subprocrunner/_logger/_null_logger.py
new/subprocrunner-2.0.1/subprocrunner/_logger/_null_logger.py
--- old/subprocrunner-2.0.0/subprocrunner/_logger/_null_logger.py
2022-01-15 13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/_logger/_null_logger.py
2024-04-06 18:02:01.000000000 +0200
@@ -1,3 +1,6 @@
+# type: ignore
+
+
class NullLogger:
level_name = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/subprocrunner-2.0.0/subprocrunner/_subprocess_runner.py
new/subprocrunner-2.0.1/subprocrunner/_subprocess_runner.py
--- old/subprocrunner-2.0.0/subprocrunner/_subprocess_runner.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/_subprocess_runner.py 2024-04-06
18:02:01.000000000 +0200
@@ -2,14 +2,13 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
import errno
import os
import platform
import subprocess
import traceback
from subprocess import PIPE
-from typing import Dict, List, Optional, Pattern, Sequence, Union, cast # noqa
+from typing import Any, Dict, List, Optional, Pattern, Sequence, Union, cast
from mbstrdecoder import MultiByteStrDecoder
@@ -20,6 +19,9 @@
from .typing import Command
+Env = Dict[str, str]
+
+
class SubprocessRunner:
"""
.. py:attribute:: default_is_dry_run
@@ -133,21 +135,21 @@
return self.__returncode
@property
- def error_log_level(self):
+ def error_log_level(self) -> None:
raise NotImplementedError()
@error_log_level.setter
- def error_log_level(self, log_level: Optional[str]):
+ def error_log_level(self, log_level: Optional[str]) -> None:
self.__error_logging_method = get_logging_method(log_level)
def _run(
self,
- env,
+ env: Optional[Env],
check: bool,
input: Union[str, bytes, None] = None,
encoding: str = "ascii",
timeout: Optional[float] = None,
- **kwargs,
+ **kwargs: Any,
) -> int:
self.__save_command()
self.__debug_print_command(retry_attept=kwargs.get(self._RETRY_ATTEMPT_KEY))
@@ -166,10 +168,14 @@
)
except TypeError:
proc = subprocess.Popen(
- self.command, shell=self.__is_shell, stdin=PIPE, stdout=PIPE,
stderr=PIPE
+ self.command,
+ shell=self.__is_shell,
+ stdin=PIPE,
+ stdout=PIPE,
+ stderr=PIPE,
)
- if input and not isinstance(input, bytes) and encoding:
+ if input and isinstance(input, str) and encoding:
input = input.encode(encoding)
stdout, stderr = proc.communicate(input=input, timeout=timeout) #
type: ignore
self.__returncode = proc.returncode
@@ -205,8 +211,8 @@
input: Union[str, bytes, None] = None,
encoding: Optional[str] = None,
timeout: Optional[float] = None,
- retry: Retry = None,
- **kwargs,
+ retry: Optional[Retry] = None,
+ **kwargs: Any,
) -> int:
self.__verify_command()
@@ -244,7 +250,12 @@
kwargs[self._RETRY_ATTEMPT_KEY] = i + 1
returncode = self._run(
- env=env, check=False, input=input, encoding=encoding,
timeout=timeout, **kwargs
+ env=env,
+ check=False,
+ input=input,
+ encoding=encoding,
+ timeout=timeout,
+ **kwargs,
)
if returncode in [0] + retry.no_retry_returncodes:
return returncode
@@ -254,7 +265,9 @@
return self.__returncode # type: ignore
- def popen(self, std_in: Optional[int] = None, env: Optional[Dict[str,
str]] = None):
+ def popen(
+ self, std_in: Optional[int] = None, env: Optional[Env] = None
+ ) -> Union[subprocess.Popen, subprocess.CompletedProcess]:
self.__verify_command()
self.__debug_print_command()
@@ -264,7 +277,10 @@
self.__returncode = 0
return subprocess.CompletedProcess(
- args=[], returncode=self.__returncode, stdout=self.__stdout,
stderr=self.__stderr
+ args=[],
+ returncode=self.__returncode,
+ stdout=self.__stdout,
+ stderr=self.__stderr,
)
try:
@@ -278,7 +294,11 @@
)
except TypeError:
process = subprocess.Popen(
- self.command, shell=self.__is_shell, stdin=std_in,
stdout=PIPE, stderr=PIPE
+ self.command,
+ shell=self.__is_shell,
+ stdin=std_in,
+ stdout=PIPE,
+ stderr=PIPE,
)
return process
@@ -299,7 +319,9 @@
def __verify_command(self) -> None:
if not self.command:
raise CommandError(
- f"invalid command: {self.command}", cmd=self.command_str,
errno=errno.EINVAL
+ f"invalid command: {self.command}",
+ cmd=self.command_str,
+ errno=errno.EINVAL,
)
if self.dry_run or platform.system() == "Windows":
@@ -322,14 +344,14 @@
self.__command_history.append(self.command_str)
@staticmethod
- def __get_env(env=None):
+ def __get_env(env: Optional[Env] = None) -> Env:
if env is not None:
return env
if platform.system() == "Linux":
return dict(os.environ, LC_ALL="C")
- return os.environ
+ return cast(Env, os.environ)
def __debug_print_command(self, retry_attept: Optional[int] = None) ->
None:
if self.__quiet:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner/_which.py
new/subprocrunner-2.0.1/subprocrunner/_which.py
--- old/subprocrunner-2.0.0/subprocrunner/_which.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/_which.py 2024-04-06
18:02:01.000000000 +0200
@@ -45,7 +45,9 @@
def verify(self) -> None:
if not self.is_exist():
raise CommandError(
- f"command not found: {self.command}", cmd=self.command,
errno=errno.ENOENT
+ f"command not found: {self.command}",
+ cmd=self.command,
+ errno=errno.ENOENT,
)
def abspath(self) -> Optional[str]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner/error.py
new/subprocrunner-2.0.1/subprocrunner/error.py
--- old/subprocrunner-2.0.0/subprocrunner/error.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner/error.py 2024-04-06
18:02:01.000000000 +0200
@@ -2,10 +2,9 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
# keep the following line for backward compatibility
from subprocess import CalledProcessError # noqa
-from typing import Optional
+from typing import Any, Optional
from .typing import Command
@@ -19,7 +18,7 @@
def errno(self) -> Optional[int]:
return self.__errno
- def __init__(self, *args, **kwargs) -> None:
+ def __init__(self, *args: str, **kwargs: Any) -> None:
self.__cmd = kwargs.pop("cmd", None)
self.__errno = kwargs.pop("errno", None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/subprocrunner.egg-info/PKG-INFO
new/subprocrunner-2.0.1/subprocrunner.egg-info/PKG-INFO
--- old/subprocrunner-2.0.0/subprocrunner.egg-info/PKG-INFO 2022-01-15
13:56:56.000000000 +0100
+++ new/subprocrunner-2.0.1/subprocrunner.egg-info/PKG-INFO 2024-04-06
18:02:25.000000000 +0200
@@ -1,15 +1,15 @@
Metadata-Version: 2.1
Name: subprocrunner
-Version: 2.0.0
+Version: 2.0.1
Summary: A Python wrapper library for subprocess module.
Home-page: https://github.com/thombashi/subprocrunner
Author: Tsuyoshi Hombashi
Author-email: [email protected]
License: MIT License
+Project-URL: Changlog, https://github.com/thombashi/subprocrunner/releases
Project-URL: Source, https://github.com/thombashi/subprocrunner
Project-URL: Tracker, https://github.com/thombashi/subprocrunner/issues
Keywords: library,subprocess
-Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
@@ -19,21 +19,29 @@
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
-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.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
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: >=3.6
+Classifier: Typing :: Typed
+Requires-Python: >=3.7
Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: mbstrdecoder<2,>=1.0.0
Provides-Extra: logging
+Requires-Dist: loguru<1,>=0.4.1; extra == "logging"
Provides-Extra: test
-License-File: LICENSE
+Requires-Dist: pytest; extra == "test"
+Requires-Dist: pytest-mock; extra == "test"
+Requires-Dist: typepy; extra == "test"
+Requires-Dist: loguru<1,>=0.4.1; extra == "test"
.. contents:: **subprocrunner**
:backlinks: top
@@ -44,26 +52,32 @@
=============
A Python wrapper library for ``subprocess`` module.
-.. image:: https://badge.fury.io/py/subprocrunner.svg
+|PyPI pkg ver| |Supported Python versions| |Supported Python implementations|
|CI status| |Test coverage| |CodeQL|
+
+.. |PyPI pkg ver| image:: https://badge.fury.io/py/subprocrunner.svg
:target: https://badge.fury.io/py/subprocrunner
:alt: PyPI package version
-.. image:: https://img.shields.io/pypi/pyversions/subprocrunner.svg
+.. |Supported Python versions| image::
https://img.shields.io/pypi/pyversions/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python versions
-.. image:: https://img.shields.io/pypi/implementation/subprocrunner.svg
+.. |Supported Python implementations| image::
https://img.shields.io/pypi/implementation/subprocrunner.svg
:target: https://pypi.org/project/subprocrunner
:alt: Supported Python implementations
-.. image::
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml/badge.svg
- :target:
https://github.com/thombashi/subprocrunner/actions/workflows/lint_and_test.yml
+.. |CI status| image::
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/ci.yml
:alt: CI status of Linux/macOS/Windows
-.. image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
+.. |Test coverage| image::
https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master
:target: https://coveralls.io/github/thombashi/subprocrunner?branch=master
:alt: Test coverage
+.. |CodeQL| image::
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql/badge.svg
+ :target:
https://github.com/thombashi/subprocrunner/actions/workflows/github-code-scanning/codeql
+ :alt: CodeQL
+
Usage
========
@@ -95,7 +109,7 @@
return code: 2
stderr: ls: cannot access '__not_exist_dir__': No such file or
directory
-Execute a command with retry
+Execute a command with retries
--------------------------------------------------------
:Sample Code:
@@ -215,12 +229,10 @@
Dependencies
============
-- Python 3.6+
+- Python 3.7+
- `Python package dependencies (automatically installed)
<https://github.com/thombashi/subprocrunner/network/dependencies>`__
Optional dependencies
----------------------------------
- `loguru <https://github.com/Delgan/loguru>`__
- Used for logging if the package installed
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/test/test_logger.py
new/subprocrunner-2.0.1/test/test_logger.py
--- old/subprocrunner-2.0.0/test/test_logger.py 2022-01-15 13:56:25.000000000
+0100
+++ new/subprocrunner-2.0.1/test/test_logger.py 2024-04-06 18:02:01.000000000
+0200
@@ -2,7 +2,6 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
import pytest
from subprocrunner import set_logger
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/test/test_subproc_runner.py
new/subprocrunner-2.0.1/test/test_subproc_runner.py
--- old/subprocrunner-2.0.0/test/test_subproc_runner.py 2022-01-15
13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/test/test_subproc_runner.py 2024-04-06
18:02:01.000000000 +0200
@@ -2,11 +2,11 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
import errno
import os
import platform
import re
+import subprocess
import sys
from subprocess import PIPE
@@ -100,6 +100,7 @@
assert runner.command == command
assert isinstance(runner.command_str, str)
assert runner.returncode == 0
+ assert runner.stdout
assert runner.stdout.strip() == expected
assert is_null_string(runner.stderr)
@@ -129,6 +130,8 @@
runner = SubprocessRunner(command,
ignore_stderr_regexp=ignore_stderr_regexp)
runner.run()
+ assert runner.stdout
+ assert runner.stderr
assert is_null_string(runner.stdout.strip())
assert is_not_null_string(runner.stderr.strip())
assert runner.returncode != 0
@@ -147,7 +150,11 @@
["command", "ignore_stderr_regexp", "expected"],
[
[[list_command, "__not_exist_dir__"], None, CalledProcessError],
- [[list_command, "__not_exist_dir__"],
re.compile(re.escape("__not_exist_dir__")), None],
+ [
+ [list_command, "__not_exist_dir__"],
+ re.compile(re.escape("__not_exist_dir__")),
+ None,
+ ],
],
)
def test_stderr_check(self, command, ignore_stderr_regexp, expected):
@@ -182,7 +189,8 @@
mocked_communicate = mocker.patch("subprocess.Popen.communicate")
mocked_communicate.return_value = (
"",
- "'dummy' ã¯ãå
é¨ã³ãã³ãã¾ãã¯å¤é¨ã³ãã³ãã"
"æä½å¯è½ãªããã°ã©ã ã¾ãã¯ããã
ãã¡ã¤ã«ã¨ãã¦èªèããã¦ãã¾ãã",
+ "'dummy' ã¯ãå
é¨ã³ãã³ãã¾ãã¯å¤é¨ã³ãã³ãã"
+ "æä½å¯è½ãªããã°ã©ã ã¾ãã¯ããã
ãã¡ã¤ã«ã¨ãã¦èªèããã¦ãã¾ãã",
)
runner = SubprocessRunner(list_command)
@@ -260,17 +268,24 @@
runner = SubprocessRunner("always-failed-command")
mocked_run = mocker.patch("subprocrunner.SubprocessRunner._run")
mocked_run.side_effect = failed_first_call
- runner.run(check=True, retry=Retry(total=3,
backoff_factor=BACKOFF_FACTOR, jitter=JITTER))
+ runner.run(
+ check=True,
+ retry=Retry(total=3, backoff_factor=BACKOFF_FACTOR, jitter=JITTER),
+ )
assert mocked_run.call_count == 2
class Test_SubprocessRunner_popen:
@pytest.mark.parametrize(
["command", "environ", "expected"],
- [["hostname", None, 0], ["hostname", dict(os.environ), 0]],
+ [
+ ["hostname", None, 0],
+ ["hostname", dict(os.environ), 0],
+ ],
)
def test_normal(self, command, environ, expected):
proc = SubprocessRunner(command).popen(env=environ)
+ assert isinstance(proc, subprocess.Popen)
ret_stdout, ret_stderr = proc.communicate()
assert is_not_null_string(ret_stdout)
assert is_null_string(ret_stderr)
@@ -280,6 +295,7 @@
@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)
+ assert isinstance(proc, subprocess.Popen)
ret_stdout, ret_stderr = proc.communicate(input=pipe_input)
assert is_not_null_string(ret_stdout)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/test/test_which.py
new/subprocrunner-2.0.1/test/test_which.py
--- old/subprocrunner-2.0.0/test/test_which.py 2022-01-15 13:56:25.000000000
+0100
+++ new/subprocrunner-2.0.1/test/test_which.py 2024-04-06 18:02:01.000000000
+0200
@@ -2,7 +2,6 @@
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-
import platform
import re
import sys
@@ -54,7 +53,12 @@
class Test_Which_is_exist:
@pytest.mark.skipif(platform.system() == "Windows", reason="platform
dependent tests")
@pytest.mark.parametrize(
- ["value", "expected"], [["ls", True], ["/bin/ls", True],
["__not_exist_command__", False]]
+ ["value", "expected"],
+ [
+ ["ls", True],
+ ["/bin/ls", True],
+ ["__not_exist_command__", False],
+ ],
)
def test_normal_linux(self, value, expected):
assert Which(value).is_exist() == expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/subprocrunner-2.0.0/tox.ini
new/subprocrunner-2.0.1/tox.ini
--- old/subprocrunner-2.0.0/tox.ini 2022-01-15 13:56:25.000000000 +0100
+++ new/subprocrunner-2.0.1/tox.ini 2024-04-06 18:02:01.000000000 +0200
@@ -1,65 +1,79 @@
[tox]
envlist =
- py{36,37,38,39,310}
+ py{37,38,39,310,311,312}
pypy3
build
- clean
cov
fmt
lint
[testenv]
-deps =
- .[test]
+extras =
+ test
commands =
pytest {posargs}
[testenv:build]
-basepython = python3.8
deps =
+ build>=1
twine
wheel
commands =
- python setup.py sdist bdist_wheel
+ python -m build
twine check dist/*.whl dist/*.tar.gz
- python setup.py clean --all
[testenv:clean]
skip_install = true
deps =
- cleanpy>=0.3.1
+ cleanpy>=0.4
commands =
cleanpy --all --exclude-envs .
[testenv:cov]
+extras =
+ test
deps =
- .[test]
coverage[toml]
commands =
coverage run -m pytest {posargs:-vv}
coverage report -m
-[testenv:fmt]
-basepython = python3.8
+[testenv:fmt-black]
skip_install = true
deps =
- autoflake
- black[jupyter]
+ autoflake>=2
+ black[jupyter]>=24.1
isort>=5
commands =
autoflake --in-place --recursive --remove-all-unused-imports
--ignore-init-module-imports .
isort .
black setup.py examples test subprocrunner
-[testenv:lint]
-basepython = python3.8
+[testenv:fmt]
skip_install = true
deps =
- codespell
- mypy>=0.910
- pylama>=8.3.6
+ autoflake>=2
+ isort>=5
+ ruff>=0.3.5
+commands =
+ autoflake --in-place --recursive --remove-all-unused-imports
--ignore-init-module-imports .
+ isort .
+ ruff format setup.py examples test subprocrunner
+
+[testenv:lint]
+extras =
+ test
+deps =
+ codespell>=2
+ mypy>=1
+ ; pylama>=8.4.1
+ pyright>=1.1
+ releasecmd
+ ruff>=0.3.5
commands =
- python setup.py check
- mypy subprocrunner
+ ; mypy subprocrunner
+ pyright
codespell subprocrunner examples test README.rst -q 2 --check-filenames
- pylama
+ ; pylama
+ ruff format --check
+ ruff check