Repository: spack/spack

Issue:
Failed to install intel-paralle-stuodio@2016 due to inexistent psxevars.csh file
I failed to install intel-paralle-stuodio@16 due to inexistent `psxevars.csh` file which is called during post-installtion. I think this post-installation should be limited to version >= 2017 according to comments in the code. 2017 and 2018 installation work well.

### Expected Result

Spack installs intel-parallel-studio.

### Actual Result

Spack fails intel-parallel-studio.

### Steps to reproduce the issue

```console
$ spack install intel-parallel-studio@cluster.2016.4+advisor+clck+daal+inspector+ipp+itac+mkl+mpi+tbb+vtune %gcc@
4.8.5
==> Installing intel-parallel-studio                                                                              
==> Fetching http://spack.pi.sjtu.edu.cn/mirror/intel-parallel-studio/intel-parallel-studio-cluster.2016.4.tgz
######################################################################## 100.0%                                    
==> Staging archive: /lustre/home/rpm/spack/var/spack/stage/intel-parallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhn
vo7urpcmyqbkgd/parallel_studio_xe_2016_update4.tgz
==> Created stage in /lustre/home/rpm/spack/var/spack/stage/intel-parallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhn
vo7urpcmyqbkgd
==> No patches needed for intel-parallel-studio
==> Building intel-parallel-studio [IntelPackage]
==> Added global license file /lustre/home/rpm/spack/etc/spack/licenses/intel/license.lic
==> Executing phase: 'configure'
==> Executing phase: 'install'
==> Error: IOError: [Errno 2] No such file or directory: '/lustre/spack/tools/linux-centos7-x86_64/gcc-4.8.5/intel-
parallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhnvo7urpcmyqbkgd/parallel_studio_xe_2016.4.072/bin/psxevars.sh'
IOError: IOError: [Errno 2] No such file or directory: '/lustre/spack/tools/linux-centos7-x86_64/gcc-4.8.5/intel-pa
rallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhnvo7urpcmyqbkgd/parallel_studio_xe_2016.4.072/bin/psxevars.sh'

/lustre/home/rpm/spack/var/spack/repos/builtin/packages/intel-parallel-studio/package.py:446, in fix_psxevars:
     7
     8             filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
     9                         os.path.join(bindir, 'psxevars.sh'),
  >> 10                        os.path.join(bindir, 'psxevars.csh'))

See build log for details:
  /lustre/home/rpm/spack/var/spack/stage/intel-parallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhnvo7urpcmyqbkgd/parallel_studio_xe_2016_update4/spack-build.out


$ tail /lustre/home/rpm/spack/var/spack/stage/intel-parallel-studio-cluster.2016.4-jnqjhwujdkmsbkqwhnvo7urpcmyqbk
gd/parallel_studio_xe_2016_update4/spack-build.out
==> Executing phase: 'configure'
==> Executing phase: 'install'
==> './install.sh' '--silent' 'silent.cfg'
Missing optional prerequisites
```
[spack-build.env.txt](https://github.com/spack/spack/files/1516441/spack-build.env.txt)
[spack-build.out.txt](https://github.com/spack/spack/files/1516443/spack-build.out.txt)

### Information on your system

I'm using CentOS 7. Installation of 2017 and 2018 work well.


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
--- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
+++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
@@ -431,15 +431,16 @@ def rpath_configuration(self):
 
     @run_after('install')
     def fix_psxevars(self):
-        """Newer versions of Intel Parallel Studio have a bug in the
+        """Newer versions (>2016) of Intel Parallel Studio have a bug in the
         ``psxevars.sh`` script."""
 
         bindir = glob.glob(join_path(
             self.prefix, 'parallel_studio*', 'bin'))[0]
 
-        filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
-                    os.path.join(bindir, 'psxevars.sh'),
-                    os.path.join(bindir, 'psxevars.csh'))
+        if self.version[1] > 2016:
+            filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
+                        os.path.join(bindir, 'psxevars.sh'),
+                        os.path.join(bindir, 'psxevars.csh'))
 
     def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
         if '+mpi' in self.spec:


Test patch: