Repository: spack/spack

Issue:
espresso : no module or dotkit file is created
Originally posted on the mailing list. Installing espresso everything seems to go fine:

```
$ spack install -j 4 espresso + mpi ^ openblas
==> Installing espresso
==> Installing netlib-scalapack
==> mpich is already installed in /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/mpich-3.2-nrn7n3mmfanakidvf2wincyv3ufml5k6.
==> openblas is already installed in /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/openblas-0.2.15-mpo65vvesylmxza7v5w5ahghvcbchnxd.
==> Already downloaded /home/culpo/github/spack/var/spack/stage/netlib-scalapack-2.0.2-rhdi75kxexltc7ejtes5oopne4uu7lpc/netlib-scalapack-2.0.2.tgz.
==> Already staged netlib-scalapack-2.0.2-rhdi75kxexltc7ejtes5oopne4uu7lpc in /home/culpo/github/spack/var/spack/stage/netlib-scalapack-2.0.2-rhdi75kxexltc7ejtes5oopne4uu7lpc.
==> No patches needed for netlib-scalapack.
==> Building netlib-scalapack.
==> Successfully installed netlib-scalapack.
  Fetch: 0.01s.  Build: 1m 48.54s.  Total: 1m 48.55s.
[+] /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/netlib-scalapack-2.0.2-rhdi75kxexltc7ejtes5oopne4uu7lpc
==> mpich is already installed in /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/mpich-3.2-nrn7n3mmfanakidvf2wincyv3ufml5k6.
==> Installing fftw
==> mpich is already installed in /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/mpich-3.2-nrn7n3mmfanakidvf2wincyv3ufml5k6.
==> Trying to fetch from file:///ssoft/E5v3/downloads/fftw/fftw-3.3.4.tar.gz
curl: (37) Couldn't open file /ssoft/E5v3/downloads/fftw/fftw-3.3.4.tar.gz
==> Fetching from file:///ssoft/E5v3/downloads/fftw/fftw-3.3.4.tar.gz failed.
==> Trying to fetch from file:///home/culpo/mirror/download/fftw/fftw-3.3.4.tar.gz
######################################################################## 100,0%
==> Staging archive: /home/culpo/github/spack/var/spack/stage/fftw-3.3.4-bljkqbojgol5dequk3b6kbcyhzyeskkm/fftw-3.3.4.tar.gz
==> Created stage in /home/culpo/github/spack/var/spack/stage/fftw-3.3.4-bljkqbojgol5dequk3b6kbcyhzyeskkm.
==> No patches needed for fftw.
==> Building fftw.
==> Successfully installed fftw.
  Fetch: 0.09s.  Build: 1m 44.79s.  Total: 1m 44.88s.
[+] /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/fftw-3.3.4-bljkqbojgol5dequk3b6kbcyhzyeskkm
==> openblas is already installed in /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/openblas-0.2.15-mpo65vvesylmxza7v5w5ahghvcbchnxd.
==> Trying to fetch from file:///ssoft/E5v3/downloads/espresso/espresso-5.3.0.tar.gz
curl: (37) Couldn't open file /ssoft/E5v3/downloads/espresso/espresso-5.3.0.tar.gz
==> Fetching from file:///ssoft/E5v3/downloads/espresso/espresso-5.3.0.tar.gz failed.
==> Trying to fetch from file:///home/culpo/mirror/download/espresso/espresso-5.3.0.tar.gz
######################################################################## 100,0%
==> Staging archive: /home/culpo/github/spack/var/spack/stage/espresso-5.3.0-h7wtev4x2iudd3kfvxdx6bj4baqxauvj/espresso-5.3.0.tar.gz
==> Created stage in /home/culpo/github/spack/var/spack/stage/espresso-5.3.0-h7wtev4x2iudd3kfvxdx6bj4baqxauvj.
==> No patches needed for espresso.
==> Building espresso.
==> Successfully installed espresso.
  Fetch: 0.19s.  Build: 2m 21.25s.  Total: 2m 21.44s.
[+] /home/culpo/github/spack/opt/spack/x86_E5v2_IntelIB/gcc-4.4.7/espresso-5.3.0-h7wtev4x2iudd3kfvxdx6bj4baqxauvj
```

except that no module or dotkit file gets created:

```
$ ls share/spack/{dotkit,modules}/x86_E5v2_IntelIB/ | grep "^e"
elpa-2015.11.001-gcc-4.9.3-2b3uaudbffhggtjde6mbvim54cl7shkv.dk
elpa-2015.11.001-gcc-4.9.3-2b3uaudbffhggtjde6mbvim54cl7shkv
```



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/espresso/package.py b/var/spack/repos/builtin/packages/espresso/package.py
--- a/var/spack/repos/builtin/packages/espresso/package.py
+++ b/var/spack/repos/builtin/packages/espresso/package.py
@@ -32,6 +32,10 @@ def check_variants(self, spec):
         if '+elpa' in spec and ('~mpi' in spec or '~scalapack' in spec):
             raise RuntimeError(error.format(variant='elpa'))
 
+    def setup_environment(self, spack_env, run_env):
+        # Espresso copies every executable in prefix without creating sub-folders
+        run_env.prepend_path('PATH', self.prefix)
+
     def install(self, spec, prefix):
         self.check_variants(spec)
 


Test patch: