From 949d4c0fa757b53f665af9ffce122fdf2682660c Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Fri, 15 Nov 2024 15:38:23 +0100 Subject: [PATCH] small stuff --- docs/src/apps.md | 16 +++++++--------- src/Apps/Apps.jl | 7 +++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/src/apps.md b/docs/src/apps.md index abd0be080e..7f9c89863a 100644 --- a/docs/src/apps.md +++ b/docs/src/apps.md @@ -3,6 +3,13 @@ !!! note The app support in Pkg is currently considered experimental and some functionality and API may change. + Some inconveniences that can be encountered are: + - You need to manually make `~/.julia/bin` available on the PATH environment. + - The path to the julia executable used is the same as the one used to install the app. If this + julia installation gets removed, you might need to reinstall the app. + used by the app might not be found. + - You can only have one app installed + Apps are Julia packages that are intended to be run as a "standalone programs" (by e.g. typing the name of the app in the terminal possibly together with some arguments or flags/options). This is in contrast to most Julia packages that are used as "libraries" and are loaded by other files or in the Julia REPL. @@ -37,7 +44,6 @@ end # module [apps] reverse = {} ``` - The empty table `{}` is to allow for giving metadata about the app but it is currently unused. After installing this app one could run: @@ -52,11 +58,3 @@ directly in the terminal. ## Installing Julia apps The installation of Julia apps are similar to installing julia libraries but instead of using e.g. `Pkg.add` or `pkg> add` one uses `Pkg.Apps.add` or `pkg> app add` (`develop` is also available). - -!!! note - The path `.julia/bin` has to be added to your `PATH` in order for apps to be runnable after being installed. - Pkg currently does not do this for you. - -## Other information - -- The app will currently run with the same Julia executable as was used to install the app. diff --git a/src/Apps/Apps.jl b/src/Apps/Apps.jl index 1fcb3a81af..a916e5e6e0 100644 --- a/src/Apps/Apps.jl +++ b/src/Apps/Apps.jl @@ -77,6 +77,8 @@ function _resolve(manifest::Manifest, pkgname=nothing) continue end if pkg.path == nothing + # TODO: Just use a normal project file now since the project itself is part of the manifest now? + projectfile = joinpath(app_env_folder(), pkg.name, "Project.toml") sourcepath = source_path(app_manifest_file(), pkg) project = get_project(sourcepath) @@ -84,16 +86,15 @@ function _resolve(manifest::Manifest, pkgname=nothing) mkpath(dirname(projectfile)) write_project(project, projectfile) package_manifest_file = manifestfile_path(sourcepath; strict=true) + # Move manifest if it exists here. if package_manifest_file !== nothing cp(package_manifest_file, joinpath(app_env_folder(), pkg.name, basename(package_manifest_file)); force=true) end - # Move manifest if it exists here. Pkg.activate(joinpath(app_env_folder(), pkg.name)) do Pkg.instantiate() end else - # TODO: Not hardcode Project.toml projectfile = projectfile_path(source_path(app_manifest_file(), pkg)) end @@ -345,6 +346,7 @@ function bash_shim(pkgname, julia::String, env) $SHIM_HEADER export JULIA_LOAD_PATH=$(repr(env)) + export JULIA_DEPOT_PATH=$(repr(join(DEPOT_PATH, ':'))) exec $julia \\ --startup-file=no \\ -m $(pkgname) \\ @@ -356,6 +358,7 @@ function windows_shim(pkgname, julia::String, env) return """ @echo off set JULIA_LOAD_PATH=$(repr(env)) + set JULIA_DEPOT_PATH=$(repr(join(DEPOT_PATH, ';'))) $julia ^ --startup-file=no ^