Repository: spack/spack

Issue:
Installation issue: qbox (installation paths, python shebang and deps)
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: <name-of-the-package>".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->

### Steps to reproduce the issue
The command
```console
spack install qbox
```
succeeds, and puts content in the installation directory, but there are some issues:

1) Almost everything is installed immediately below the installation prefix for the package.  The qbox website implies that the python/gnuplot scripts should be in the utils subdir, and there are a number of broken symlinks (e.g. qbdriver/H_HSCV_PBE-1.0.xml which seems to be because qbdriver should have been installed as a subdir of util, etc).

2) The main qb executable is installed (and the sole file in) the src subdirectory --- this seems rather incongruous.

3) The spack produced Tcl modulefile does not include a PATH setting to find the qb executable (this appears to be related to issue (2))

4) Most of the python scripts included have shebangs using /usr/bin/python.  This is problematic as:
  1. This forces use of system installed (as opposed to spack installed) python
  2. RHEL8 systems often have only /usr/bin/python2 and /usr/bin/python3, not /usr/bin/python
  3. The scripts fail under python3 (I did not look into in detail, but most of the scripts have
  python2 style print statements as opposed to python3 style print functions.  Not sure if 
  there are any more significant python2-isms)
I am not sure if there is a major issue of using system vs spack installed python (assuming
system installed exists and is compatible version) --- I do not see any evidence of the scripts
using non-standard python modules, and they seem to be self-contained.  

5) The utilities include python(python2) scripts and gnuplot scripts, but neither python2 nor gnuplot included as run dependencies.

I am not an user of qbox (I am installing on behalf of one of my users), but issues 1, 2, and 3
seem wrong.  I think the shebangs for the python scripts should use python from the user's
path (thereby allowing use of system python unless someone sets up a spack python). 




<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->



### Information on your system

<!-- Please include the output of `spack debug report` -->
```console
spack debug report
* **Spack:** 0.14.2
* **Python:** 3.6.8
* **Platform:** linux-rhel8-ivybridge
```

### Additional information

The spack-build-out.txt, spack-build-env.txt files do not seem relevant, as the installation
technically succeeds.

No maintainers found for qbox

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x ] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x ] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files
- [x ] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/qbox/package.py b/var/spack/repos/builtin/packages/qbox/package.py
--- a/var/spack/repos/builtin/packages/qbox/package.py
+++ b/var/spack/repos/builtin/packages/qbox/package.py
@@ -43,6 +43,11 @@ class Qbox(MakefilePackage):
     depends_on('scalapack')
     depends_on('fftw')
     depends_on('xerces-c')
+    depends_on('python@:2.999', type='run')
+    depends_on('gnuplot', type='run')
+
+    # Change /usr/bin/python shebangs to /usr/bin/env python
+    patch('qbox-python-shebang-path.patch')
 
     build_directory = 'src'
 
@@ -64,9 +69,12 @@ def edit(self, spec, prefix):
             ))))
         filter_file('$(TARGET)', 'spack', 'src/Makefile', string=True)
 
+    def setup_run_environment(self, env):
+        env.prepend_path('PATH', self.prefix.util)
+
     def install(self, spec, prefix):
-        mkdir(prefix.src)
-        install('src/qb', prefix.src)
-        install_tree('test', prefix)
-        install_tree('xml', prefix)
-        install_tree('util', prefix)
+        mkdir(prefix.bin)
+        install('src/qb', prefix.bin)
+        install_tree('test', prefix.test)
+        install_tree('xml', prefix.xml)
+        install_tree('util', prefix.util)


Test patch: