1
0
Fork 0

Adding upstream version 3.7.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 21:49:38 +01:00
parent a8737b0b29
commit d24c1558a4
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 28 additions and 9 deletions

View file

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v4.6.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
@ -24,7 +24,7 @@ repos:
hooks: hooks:
- id: add-trailing-comma - id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.15.1 rev: v3.15.2
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py39-plus] args: [--py39-plus]
@ -37,7 +37,7 @@ repos:
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0 rev: v1.10.0
hooks: hooks:
- id: mypy - id: mypy
additional_dependencies: [types-all] additional_dependencies: [types-all]

View file

@ -1,3 +1,12 @@
3.7.1 - 2024-05-10
==================
### Fixes
- Fix `language: rust` default language version check when `rust-toolchain.toml`
is present.
- issue by @gaborbernat.
- #3201 PR by @asottile.
3.7.0 - 2024-03-24 3.7.0 - 2024-03-24
================== ==================

View file

@ -34,7 +34,7 @@ def get_default_version() -> str:
# Just detecting the executable does not suffice, because if rustup is # Just detecting the executable does not suffice, because if rustup is
# installed but no toolchain is available, then `cargo` exists but # installed but no toolchain is available, then `cargo` exists but
# cannot be used without installing a toolchain first. # cannot be used without installing a toolchain first.
if cmd_output_b('cargo', '--version', check=False)[0] == 0: if cmd_output_b('cargo', '--version', check=False, cwd='/')[0] == 0:
return 'system' return 'system'
else: else:
return C.DEFAULT return C.DEFAULT

View file

@ -205,10 +205,11 @@ else: # pragma: no cover
def _handle_readonly( def _handle_readonly(
func: Callable[[str], object], func: Callable[[str], object],
path: str, path: str,
exc: OSError, exc: Exception,
) -> None: ) -> None:
if ( if (
func in (os.rmdir, os.remove, os.unlink) and func in (os.rmdir, os.remove, os.unlink) and
isinstance(exc, OSError) and
exc.errno in {errno.EACCES, errno.EPERM} exc.errno in {errno.EACCES, errno.EPERM}
): ):
for p in (path, os.path.dirname(path)): for p in (path, os.path.dirname(path)):
@ -222,7 +223,7 @@ if sys.version_info < (3, 12): # pragma: <3.12 cover
def _handle_readonly_old( def _handle_readonly_old(
func: Callable[[str], object], func: Callable[[str], object],
path: str, path: str,
excinfo: tuple[type[OSError], OSError, TracebackType], excinfo: tuple[type[Exception], Exception, TracebackType],
) -> None: ) -> None:
return _handle_readonly(func, path, excinfo[1]) return _handle_readonly(func, path, excinfo[1])

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = pre_commit name = pre_commit
version = 3.7.0 version = 3.7.1
description = A framework for managing and maintaining multi-language pre-commit hooks. description = A framework for managing and maintaining multi-language pre-commit hooks.
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown

View file

@ -91,8 +91,8 @@ def test_ruby_additional_deps(tmp_path):
tmp_path, tmp_path,
ruby, ruby,
'ruby -e', 'ruby -e',
args=('require "tins"',), args=('require "jmespath"',),
deps=('tins',), deps=('jmespath',),
) )
assert ret == (0, b'') assert ret == (0, b'')

View file

@ -9,6 +9,7 @@ from pre_commit import parse_shebang
from pre_commit.languages import rust from pre_commit.languages import rust
from pre_commit.store import _make_local_repo from pre_commit.store import _make_local_repo
from testing.language_helpers import run_language from testing.language_helpers import run_language
from testing.util import cwd
ACTUAL_GET_DEFAULT_VERSION = rust.get_default_version.__wrapped__ ACTUAL_GET_DEFAULT_VERSION = rust.get_default_version.__wrapped__
@ -29,6 +30,14 @@ def test_uses_default_when_rust_is_not_available(cmd_output_b_mck):
assert ACTUAL_GET_DEFAULT_VERSION() == C.DEFAULT assert ACTUAL_GET_DEFAULT_VERSION() == C.DEFAULT
def test_selects_system_even_if_rust_toolchain_toml(tmp_path):
toolchain_toml = '[toolchain]\nchannel = "wtf"\n'
tmp_path.joinpath('rust-toolchain.toml').write_text(toolchain_toml)
with cwd(tmp_path):
assert ACTUAL_GET_DEFAULT_VERSION() == 'system'
def _make_hello_world(tmp_path): def _make_hello_world(tmp_path):
src_dir = tmp_path.joinpath('src') src_dir = tmp_path.joinpath('src')
src_dir.mkdir() src_dir.mkdir()