FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

set `JULIA_DEPOT_PATH` by damonbayer · Pull Request #3711 · pre-commit/pre-commit · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 7 additions & 0 deletions pre_commit/languages/julia.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def get_env_patch(target_dir: str, version: str) -> PatchesT:
('JULIA_LOAD_PATH', target_dir),
# May be set, remove it to not interfer with LOAD_PATH
('JULIA_PROJECT', UNSET),
# Keep the package depot inside the hook environment so installed
# packages and precompile caches persist with the env instead of
# leaking into a shared depot. The trailing separator leaves an empty
# entry, which julia expands to its default depots. This keeps the
# bundled stdlib resources (and their precompile caches) available so
# hooks don't recompile from scratch on first run.
('JULIA_DEPOT_PATH', os.path.join(target_dir, 'depot') + os.pathsep),
)


Expand Down
15 changes: 15 additions & 0 deletions tests/languages/julia_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import os
from unittest import mock

from pre_commit import constants as C
from pre_commit.languages import julia
from pre_commit.prefix import Prefix
from testing.language_helpers import run_language
from testing.util import cwd

Expand Down Expand Up @@ -42,6 +44,19 @@ def test_julia_hook_with_startup(tmp_path):
test_julia_hook(tmp_path)


def test_julia_hook_installs_into_env_local_depot(tmp_path):
code = """
using Example
println("Hello, world!")
"""
_make_hook(tmp_path, code)

julia.install_environment(Prefix(str(tmp_path)), C.DEFAULT, ())

d = tmp_path.joinpath('juliaenv-default', 'depot', 'packages', 'Example')
assert d.is_dir()


def test_julia_hook_manifest(tmp_path):
code = """
using Example
Expand Down
Loading

Back | FazBrowse Home | New Git URL