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

**URL:** <https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502>\
**Category:** General Usage\
**Created:** [August 15, 2018, 2:30pm UTC](https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502 "2018-08-15T14:30:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [August 15, 2018, 2:30pm UTC](https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502/1 "2018-08-15T14:30:36Z")

</div>

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

```julia
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

```bash
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?

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [August 16, 2018, 2:13pm UTC](https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502/2 "2018-08-16T14:13:53Z")

</div>

[DSP.jl](https://github.com/JuliaDSP/DSP.jl/blob/master/.travis.yml) 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.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 16, 2018, 3:27pm UTC](https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502/3 "2018-08-16T15:27:15Z")

</div>

> [@ExpandingMan](#):
>
> 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?

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](https://github.com/JuliaLang/julia/issues/27592)).

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [August 16, 2018, 3:53pm UTC](https://discourse.julialang.org/t/status-of-pkg-dir-and-writing-travis-and-other-configs/13502/4 "2018-08-16T15:53:23Z")

</div>

Also I just merged [LibSndFile.jl](https://github.com/JuliaAudio/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.
