|
8 | 8 |
|
9 | 9 | from pre_commit.envcontext import envcontext |
10 | 10 | from pre_commit.envcontext import PatchesT |
| 11 | +from pre_commit.envcontext import UNSET |
11 | 12 | from pre_commit.hook import Hook |
12 | 13 | from pre_commit.languages import helpers |
13 | 14 | from pre_commit.prefix import Prefix |
|
23 | 24 | def get_env_patch(venv: str) -> PatchesT: |
24 | 25 | return ( |
25 | 26 | ('R_PROFILE_USER', os.path.join(venv, 'activate.R')), |
| 27 | + ('RENV_PROJECT', UNSET), |
26 | 28 | ) |
27 | 29 |
|
28 | 30 |
|
@@ -54,11 +56,12 @@ def _prefix_if_non_local_file_entry( |
54 | 56 | path = prefix.path(entry[1]) |
55 | 57 | return (path,) |
56 | 58 |
|
57 | | -def _rscript_exec(): |
| 59 | + |
| 60 | +def _rscript_exec() -> str: |
58 | 61 | """ |
59 | 62 | When invoked in a sub-process of R, use full path |
60 | 63 | """ |
61 | | - return os.path.join(os.getenv('R_HOME', ""), 'Rscript') |
| 64 | + return os.path.join(os.getenv('R_HOME', ''), 'Rscript') |
62 | 65 |
|
63 | 66 |
|
64 | 67 | def _entry_validate(entry: Sequence[str]) -> None: |
@@ -101,7 +104,7 @@ def install_environment( |
101 | 104 | os.makedirs(env_dir, exist_ok=True) |
102 | 105 | shutil.copy(prefix.path('renv.lock'), env_dir) |
103 | 106 | shutil.copytree(prefix.path('renv'), os.path.join(env_dir, 'renv')) |
104 | | - |
| 107 | + |
105 | 108 | cmd_output_b( |
106 | 109 | _rscript_exec(), '--vanilla', '-e', |
107 | 110 | f"""\ |
|
0 commit comments