Julia 1.0 Replacement for `Pkg.clone(url::String, name::String)` and adding in Project.toml

package

#1

Is there an equivalent function for Pkg.clone(url::String, name::String) in Julia 1.0 that can be used to add an unregistered package to a project/package .toml. To be cloned automatically in new environment, using Pkg.clone(url::String, name::String) adds the local .julia/dev/… to the manifest.
My use case is bitbucket only uses lower case names in the url. Therefore, I specify the name explicitly.
eg. Pkg.clone("..../mypackage.jl.git", "MyPackage")
Currently Pkg.add uses mypackage for the package name instead of MyPackage .


#2

Ok, after scratching around a bit in the Pkg source I found a way that will work for now:

using Pkg
cnt = Pkg.Types.Context()
cnt.old_pkg2_clone_name = "PackageName"
Pkg.add(cnt,[PackageSpec(url="https://.../.../packagename.jl.git")])

I’m sure there must be a better way, but this seems to work.


#3

Are you looking for

pkg> activate path_to_package
pkg> dev path_or_url_to_dependency

?

See the manual.


#4

No, not exactly. If you use dev url_to_dependency, the case is still wrong for existing julia 0.6 packages.
I just saw if you manually update the name field in the Project.toml file in the package it works as expected with just add url_to_dependency.

So the workflow that works for me:

  • get existing julia 0.6 packages with Pkg.clone("..../mypackage.jl.git", "MyPackage")
  • update packages to julia 1.0
  • add .toml files use name = “MyPackage”
    The next time the package is added with add url_to_dependency, the name folder name is correct and the package is found.