Juleps icon indicating copy to clipboard operation
Juleps copied to clipboard

Pkg3: relative paths for adding local packages

Open djsegal opened this issue 7 years ago • 3 comments

So you can do,

Pkg.add("UTF64", "~/code/UTF64.jl")


edit:

i know you can just keep monkeying around with ~/.julia/v0.5/UTF64, it just feels a little dirty

djsegal avatar Mar 02 '17 19:03 djsegal

That second param could probably be a keyword argument under the name "path"

Along with others like:

  • Github
  • Branch
  • Version

djsegal avatar Jul 17 '17 17:07 djsegal

Yeah, I do this enough that I've just added the following to my juliarc.

using FilePaths

function Base.Pkg.add(path::AbstractPath)
    extension(path) == "jl" || throw(ArgumentError("Expected pkg directory to end with '.jl'"))
    pkg_name = filename(path)
    pkg_dir = Path(Pkg.dir(pkg_name))
        
    Pkg.clone(String(path))
    remove(pkg_dir; recursive=true)
    symlink(path, pkg_dir)
end

rofinn avatar Jul 17 '17 19:07 rofinn

You can clone from filesystem-local repositories already, though it does make a copy.

tkelman avatar Jul 18 '17 10:07 tkelman