Skip to content

Commit b7331b6

Browse files
unset renv project
1 parent ba496b8 commit b7331b6

File tree

1 file changed

+6
-3
lines changed
  • pre_commit/languages

1 file changed

+6
-3
lines changed

pre_commit/languages/r.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from pre_commit.envcontext import envcontext
1010
from pre_commit.envcontext import PatchesT
11+
from pre_commit.envcontext import UNSET
1112
from pre_commit.hook import Hook
1213
from pre_commit.languages import helpers
1314
from pre_commit.prefix import Prefix
@@ -23,6 +24,7 @@
2324
def get_env_patch(venv: str) -> PatchesT:
2425
return (
2526
('R_PROFILE_USER', os.path.join(venv, 'activate.R')),
27+
('RENV_PROJECT', UNSET),
2628
)
2729

2830

@@ -54,11 +56,12 @@ def _prefix_if_non_local_file_entry(
5456
path = prefix.path(entry[1])
5557
return (path,)
5658

57-
def _rscript_exec():
59+
60+
def _rscript_exec() -> str:
5861
"""
5962
When invoked in a sub-process of R, use full path
6063
"""
61-
return os.path.join(os.getenv('R_HOME', ""), 'Rscript')
64+
return os.path.join(os.getenv('R_HOME', ''), 'Rscript')
6265

6366

6467
def _entry_validate(entry: Sequence[str]) -> None:
@@ -101,7 +104,7 @@ def install_environment(
101104
os.makedirs(env_dir, exist_ok=True)
102105
shutil.copy(prefix.path('renv.lock'), env_dir)
103106
shutil.copytree(prefix.path('renv'), os.path.join(env_dir, 'renv'))
104-
107+
105108
cmd_output_b(
106109
_rscript_exec(), '--vanilla', '-e',
107110
f"""\

0 commit comments

Comments
 (0)