Skip to content

Commit

Permalink
wip [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Apr 17, 2018
1 parent 1d3c400 commit 8f76391
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ end

find_env(env::Function) = find_env(env())

load_path() = filter(env -> env nothing, map(find_env, LOAD_PATH))
load_path() = String[env for env in map(find_env, LOAD_PATH) if env nothing]

## package identification: determine unique identity of package to be loaded ##

Expand Down
24 changes: 7 additions & 17 deletions doc/src/manual/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,13 @@ and a global configuration search path of
### `JULIA_LOAD_PATH`

A separated list of absolute paths that are to be appended to the variable
[`LOAD_PATH`](@ref). (In Unix-like systems, the path separator is `:`; in Windows
systems, the path separator is `;`.) The `LOAD_PATH` variable is where
[`Base.require`](@ref) and `Base.load_in_path()` look for code; it defaults to the absolute
paths

```
$JULIA_HOME/../local/share/julia/stdlib/v$(VERSION.major).$(VERSION.minor)
$JULIA_HOME/../share/julia/stdlib/v$(VERSION.major).$(VERSION.minor)
```

so that, e.g., version 0.7 of Julia on a Linux system with a Julia executable at
`/bin/julia` will have a default `LOAD_PATH` of

```
/local/share/julia/stdlib/v0.7
/share/julia/stdlib/v0.7
```
[`LOAD_PATH`](@ref). (In Unix-like systems, the path separator is `:`; in
Windows systems, the path separator is `;`.) The `LOAD_PATH` variable is where
[`Base.require`](@ref) and `Base.load_in_path()` look for code; it defaults to
the absolute path
`$JULIA_HOME/../share/julia/stdlib/v$(VERSION.major).$(VERSION.minor)` so that,
e.g., version 0.7 of Julia on a Linux system with a Julia executable at
`/bin/julia` will have a default `LOAD_PATH` of `/share/julia/stdlib/v0.7`.

### `JULIA_PKGDIR`

Expand Down
3 changes: 2 additions & 1 deletion stdlib/Pkg3/src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ mutable struct EnvCache
project_file = Base.find_env(entry)
project_file isa String && !isdir(project_file) && break
end
project_file === nothing && error("No Pkg3 environment found in LOAD_PATH")
project_file isa String && !isdir(project_file) ||
error("No Pkg3 environment found in LOAD_PATH")
elseif env isa AbstractEnv
project_file = Base.find_env(env)
project_file === nothing && error("package environment does not exist: $env")
Expand Down
2 changes: 2 additions & 0 deletions stdlib/Pkg3/test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ include("utils.jl")
const TEST_PKG = (name = "Example", uuid = UUID("7876af07-990d-54b4-ab0e-23690620f79a"))

temp_pkg_dir() do project_path
@show LOAD_PATH
@show readdir(project_path)
@testset "simple add and remove with preview" begin
Pkg3.init(project_path)
Pkg3.add(TEST_PKG.name; preview = true)
Expand Down
3 changes: 1 addition & 2 deletions stdlib/Pkg3/test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function temp_pkg_dir(fn::Function)
pushfirst!(DEPOT_PATH, depot_dir)
# Add the standard library paths back
vers = "v$(VERSION.major).$(VERSION.minor)"
push!(LOAD_PATH, abspath(Sys.BINDIR, "..", "local", "share", "julia", "stdlib", vers))
push!(LOAD_PATH, abspath(Sys.BINDIR, "..", "share", "julia", "stdlib", vers))
fn(env_dir)
end
Expand All @@ -34,4 +33,4 @@ function cd_tempdir(f)
end
end

isinstalled(pkg) = Base.locate_package(Base.PkgId(pkg.uuid, pkg.name)) !== nothing
isinstalled(pkg) = Base.locate_package(Base.PkgId(pkg.uuid, pkg.name)) !== nothing

0 comments on commit 8f76391

Please sign in to comment.