1
0
Fork 0

Adding upstream version 2.11.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 21:25:57 +01:00
parent 0c77307851
commit 3faf89852c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
4 changed files with 18 additions and 13 deletions

View file

@ -21,7 +21,7 @@ repos:
hooks: hooks:
- id: autopep8 - id: autopep8
- repo: https://github.com/pre-commit/pre-commit - repo: https://github.com/pre-commit/pre-commit
rev: v2.11.0 rev: v2.11.1
hooks: hooks:
- id: validate_manifest - id: validate_manifest
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade

View file

@ -1,3 +1,10 @@
2.11.1 - 2021-03-09
===================
### Fixes
- Fix r hooks when hook repo is a package
- #1831 PR by @lorenzwalthert.
2.11.0 - 2021-03-07 2.11.0 - 2021-03-07
=================== ===================

View file

@ -88,13 +88,11 @@ def install_environment(
env_dir = _get_env_dir(prefix, version) env_dir = _get_env_dir(prefix, version)
with clean_path_on_failure(env_dir): with clean_path_on_failure(env_dir):
os.makedirs(env_dir, exist_ok=True) os.makedirs(env_dir, exist_ok=True)
path_desc_source = prefix.path('DESCRIPTION')
if os.path.exists(path_desc_source):
shutil.copy(path_desc_source, env_dir)
shutil.copy(prefix.path('renv.lock'), env_dir) shutil.copy(prefix.path('renv.lock'), env_dir)
cmd_output_b( cmd_output_b(
'Rscript', '--vanilla', '-e', 'Rscript', '--vanilla', '-e',
"""\ f"""\
prefix_dir <- {prefix.prefix_dir!r}
missing_pkgs <- setdiff( missing_pkgs <- setdiff(
"renv", unname(installed.packages()[, "Package"]) "renv", unname(installed.packages()[, "Package"])
) )
@ -109,15 +107,15 @@ def install_environment(
'renv::activate("', file.path(getwd()), '"); ' 'renv::activate("', file.path(getwd()), '"); '
) )
writeLines(activate_statement, 'activate.R') writeLines(activate_statement, 'activate.R')
is_package <- tryCatch( is_package <- tryCatch({{
suppressWarnings( content_desc <- read.dcf(file.path(prefix_dir, 'DESCRIPTION'))
unname(read.dcf('DESCRIPTION')[,'Type'] == "Package") suppressWarnings(unname(content_desc[,'Type']) == "Package")
), }},
error = function(...) FALSE error = function(...) FALSE
) )
if (is_package) { if (is_package) {{
renv::install(normalizePath('.')) renv::install(prefix_dir)
} }}
""", """,
cwd=env_dir, cwd=env_dir,
) )

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = pre_commit name = pre_commit
version = 2.11.0 version = 2.11.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