Status of `Pkg.dir` and writing travis and other configs

I was dreading getting travis to work on both 0.6 and 1.0 as I believed that Pkg.dir would throw an error in 1.0, but mercifully I discovered today that even in 1.0 Pkg.dir still only gives a warning. I was wondering why that is, is there a plan to bring it back?

Unfortunately the new pathof alternative is rather unwieldy in travis scripts

import Pkg, PackageName; cd(joinpath(dirname(pathof(PackageName)),"..","otherdir"); other_functions()

Of course this code doesn’t work on 0.6. Without knowing how to make version dependent travis scripts, I’ve taken to doing

VERSION < v"0.7-" || using Pkg; cd(Pkg.dir("PackageName"))

since using Pkg throws an error in 0.6.

Does anyone have any more elaborate travis or aws scripts or yamls for both 0.6 and 1.0 that they care to share as helpful examples?

DSP.jl works on 0.6 through nightly and is tested on travis for all of them. It uses the default testing script, but has extra stuff for coverage upload and building the docs. Luckily with the new Pkg we just add the current directory and everything is run from there, so there’s no need to cd into the package directory (we’re already there!).

I think I pulled liberally from some Invenia packages, which also do a nice job of this.

1 Like

In 0.7 and later you should use pathof(::Module) in cases where this functionality is needed (see the discussion at Expose Base.find_package? · Issue #27592 · JuliaLang/julia · GitHub).

Also I just merged LibSndFile.jl which has a bit more complicated CI setup. It includes appveyor, and also the master branch currently depends on the master branch of SampledSignals (the plan is to tag them together once a few more things get ironed out), so the CI scripts needed some extra stuff to check out master. Might be more complicated than they need to be, but they seem to be working.