diff --git a/README.md b/README.md index 8385fa6..0c49560 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,8 @@ See also git tags: https://github.com/jedie/manageprojects/tags [comment]: <> (✂✂✂ auto generated history start ✂✂✂) +* [v0.16.1](https://github.com/jedie/manageprojects/compare/v0.16.0...v0.16.1) + * 2023-12-05 - Fix "format file" and very verbose error output * [v0.16.0](https://github.com/jedie/manageprojects/compare/v0.15.4...v0.16.0) * 2023-12-02 - Use code style tooling from cli-base-utilities * 2023-12-01 - Apply https://github.com/jedie/cookiecutter_templates updates @@ -330,11 +332,11 @@ See also git tags: https://github.com/jedie/manageprojects/tags * [v0.15.3](https://github.com/jedie/manageprojects/compare/v0.15.2...v0.15.3) * 2023-11-09 - Bugfix "reverse" if context contains a list * 2023-11-07 - Update requirements -* [v0.15.2](https://github.com/jedie/manageprojects/compare/v0.15.1...v0.15.2) - * 2023-11-01 - Update requirements
Expand older history entries ... +* [v0.15.2](https://github.com/jedie/manageprojects/compare/v0.15.1...v0.15.2) + * 2023-11-01 - Update requirements * [v0.15.1](https://github.com/jedie/manageprojects/compare/v0.15.0...v0.15.1) * 2023-10-08 - Update text matrix with Python v3.12 * 2023-10-08 - fix github CI diff --git a/manageprojects/__init__.py b/manageprojects/__init__.py index 0a6dcc4..f99d8c5 100644 --- a/manageprojects/__init__.py +++ b/manageprojects/__init__.py @@ -3,5 +3,5 @@ Manage Python / Django projects """ -__version__ = '0.16.0' +__version__ = '0.16.1' __author__ = 'Jens Diemer ' diff --git a/manageprojects/format_file.py b/manageprojects/format_file.py index 9b4205f..3a1fd58 100644 --- a/manageprojects/format_file.py +++ b/manageprojects/format_file.py @@ -1,10 +1,11 @@ import dataclasses +import subprocess from pathlib import Path from typing import Optional from bx_py_utils.dict_utils import dict_get from cli_base.cli_tools.git import Git, GitError, NoGitRepoError -from cli_base.cli_tools.subprocess_utils import ToolsExecutor +from cli_base.cli_tools.subprocess_utils import ToolsExecutor as OriginalToolsExecutor from editorconfig import EditorConfigError, get_properties from packaging.specifiers import SpecifierSet from packaging.version import Version @@ -19,6 +20,14 @@ MAX_PY3_VER = 15 +class ToolsExecutor(OriginalToolsExecutor): + def verbose_check_call(self, *args, **kwargs): + try: + super().verbose_check_call(*args, **kwargs) + except subprocess.CalledProcessError: + pass # Info print is already done + + @dataclasses.dataclass class GitInfo: cwd: Path @@ -152,7 +161,7 @@ def get_config( def run_pyupgrade(tools_executor, file_path, config): pyver_arg = f'--{config.py_ver_str}-plus' - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'pyupgrade', '--exit-zero-even-if-changed', pyver_arg, @@ -166,7 +175,7 @@ def run_autoflake(tools_executor, file_path, config, remove_all_unused_imports): if remove_all_unused_imports: args.append('--remove-all-unused-imports') args.append(file_path) - tools_executor.verbose_check_output(*args) + tools_executor.verbose_check_call(*args) def run_darker(tools_executor, file_path, config, darker_prefixes): @@ -175,7 +184,7 @@ def run_darker(tools_executor, file_path, config, darker_prefixes): # "E302 expected 2 blank lines" # "E303 too many blank lines (4)" # work-a-round: run autopep8 only for these fixes ;) - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'autopep8', '--ignore-local-config', '--select', @@ -185,7 +194,7 @@ def run_darker(tools_executor, file_path, config, darker_prefixes): str(file_path), ) - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'darker', '--flynt', '--isort', @@ -201,7 +210,7 @@ def run_darker(tools_executor, file_path, config, darker_prefixes): def run_autopep8(tools_executor, file_path, config): - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'autopep8', '--ignore-local-config', '--max-line-length', @@ -214,7 +223,7 @@ def run_autopep8(tools_executor, file_path, config): def run_flake8(tools_executor, file_path, config): - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'flake8', '--max-line-length', str(config.max_line_length), @@ -223,15 +232,15 @@ def run_flake8(tools_executor, file_path, config): def run_pyflakes(tools_executor, file_path, config): - tools_executor.verbose_check_output('pyflakes', file_path) + tools_executor.verbose_check_call('pyflakes', file_path) def run_codespell(tools_executor, file_path, config): - tools_executor.verbose_check_output('codespell', file_path) + tools_executor.verbose_check_call('codespell', file_path) def run_mypy(tools_executor, file_path, config): - tools_executor.verbose_check_output( + tools_executor.verbose_check_call( 'mypy', '--ignore-missing-imports', '--follow-imports',