Repository: spack/spack

Issue:
Installation issue: py-spyder: The setuptools dependency causes build failure

---

### Steps to reproduce the issue

```console
$ spack install py-spyder
==> Installing py-spyder
==> Using cached archive: /opt/sw/fw/rsc/Spack/srcCache/py-spyder/py-spyder-3.1.3.tar.gz
==> Staging archive: /opt/sw/fw/rsc/Spack/spackSoftware/spack-20180706/var/spack/stage/py-spyder-3.1.3-b7euzpxm2zronjc4kmhgpskqrp4dwyyf/spyder-3.1.3.tar.gz
==> Created stage in /opt/sw/fw/rsc/Spack/spackSoftware/spack-20180706/var/spack/stage/py-spyder-3.1.3-b7euzpxm2zronjc4kmhgpskqrp4dwyyf
==> No patches needed for py-spyder
==> Building py-spyder [PythonPackage]
==> Executing phase: 'build'
==> Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/opt/sw/fw/rsc/Spack/installHome/linux-sles12-x86_64/gcc-7/python-2.7.15-hknd33vagen27gb4p7keyvx7c6i7f43e/bin/python2.7' '-s' 'setup.py' '--no-user-cfg' 'install' '--prefix=/opt/sw/fw/rsc/Spack/installHome/linux-sles12-x86_64/gcc-7/py-spyder-3.1.3-b7euzpxm2zronjc4kmhgpskqrp4dwyyf' '--single-version-externally-managed' '--root=/'

1 error found in build log:
     935    ==> '/opt/sw/fw/rsc/Spack/installHome/linux-sles12-x86_64/gcc-7/python-2.7.15-hknd33
            vagen27gb4p7keyvx7c6i7f43e/bin/python2.7' '-s' 'setup.py' '--no-user-cfg' 'install'
            '--prefix=/opt/sw/fw/rsc/Spack/installHome/linux-sles12-x86_64/gcc-7/py-spyder-3.1.3
            -b7euzpxm2zronjc4kmhgpskqrp4dwyyf' '--single-version-externally-managed' '--root=/'
     936    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     937       or: setup.py --help [cmd1 cmd2 ...]
     938       or: setup.py --help-commands
     939       or: setup.py cmd --help
     940
  >> 941    error: option --single-version-externally-managed not recognized

```

### Platform and user environment

```commandline
$ uname -a 
Linux athena52 4.4.132-94.33-default #1 SMP Tue May 29 20:09:56 UTC 2018 (76aae3b) x86_64 x86_64 x86_64 GNU/Linux
``` 

### Additional information

The package.py has a depends_on('py-setuptools'), which is what causes it to include the switch for 
--single-version-externally-managed 
see build_systems/python.py line 253. 

However, it seems that spyder's setup.py does not actually use setuptools, and therefore does not recognise the extra option. If I comment out the dependency, then it build OK. 

I am a bit unsure how this ever worked, although since it has been there for quite some time, I presume that it did. So, I was not confident enough to suggest changing it without guidance, hence I am raising an issue, rather than a pull request. Feel free to tell me I am doing something silly. 




Discussion:
Seem that I screwed up the package checking and we only installed it with a pretty old version of spack (i.e. before `--single-version-externally-managed` was added). I'll have a PR in a couple of hours

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-spyder/package.py b/var/spack/repos/builtin/packages/py-spyder/package.py
--- a/var/spack/repos/builtin/packages/py-spyder/package.py
+++ b/var/spack/repos/builtin/packages/py-spyder/package.py
@@ -34,7 +34,7 @@ class PySpyder(PythonPackage):
     version('3.1.3', '4b9b7c8c3e6dc00001e6e98473473c36')
     version('2.3.9', 'dd01e07a77123c128ff79ba57b97c1d7')
 
-    depends_on('py-setuptools',       type='build')
+    depends_on('python@2.7.0:2.8.0,3.3.0:', type=('build', 'run'))
     depends_on('py-rope@0.9.4:',      type=('build', 'run'), when='^python@:3')
     # depends_on('py-rope_py3k',    type=('build', 'run'), when='^python@3:')
     depends_on('py-jedi@0.9.0',       type=('build', 'run'))
@@ -44,12 +44,21 @@ class PySpyder(PythonPackage):
     depends_on('py-qtconsole@4.2.0:', type=('build', 'run'))
     depends_on('py-nbconvert',        type=('build', 'run'))
     depends_on('py-sphinx',           type=('build', 'run'))
-    depends_on('py-pycodestyle',      type=('build', 'run'))
+    # The pycodestyle dependency is split in two, because internally it
+    # changes its name from pep8 to pycodestyle, and spyder does not cope
+    # with this change until @3.2.0
+    # https://github.com/PyCQA/pycodestyle/issues/466
+    # https://github.com/spyder-ide/spyder/blob/master/CHANGELOG.md#version-32-2017-07-24
+    depends_on('py-pycodestyle@:1.7.1', when='@:3.1.99', type=('build', 'run'))
+    depends_on('py-pycodestyle@2.1.0:', when='@3.2.0:',  type=('build', 'run'))
     depends_on('py-pylint',           type=('build', 'run'))
     depends_on('py-psutil',           type=('build', 'run'))
     depends_on('py-qtawesome@0.4.1:', type=('build', 'run'))
     depends_on('py-qtpy@1.1.0:',      type=('build', 'run'))
-    depends_on('py-zmq',              type=('build', 'run'))
-    depends_on('py-chardet@2:',       type=('build', 'run'))
+    # technically this is a transitive dependency in order for py-pyqt
+    # to pick up webkit, but this is the easier solution (see #9207)
+    depends_on('qt+webkit',           type=('build', 'run'))
     depends_on('py-pickleshare',      type=('build', 'run'))
+    depends_on('py-zmq',              type=('build', 'run'))
+    depends_on('py-chardet@2.0.0:',   type=('build', 'run'))
     depends_on('py-numpydoc',         type=('build', 'run'))


Test patch: