Repository: spack/spack

Issue:
Cannot install py-entrypoints on an airgapped system
I'm working with the following setup: I have a frontend, which has access to the general internet but I'm trying to build on an airgapped cluster which has only access to a local file system.

In order to install stuff on the cluster, I'm doing a
```
spack fetch -dependencies py-entrypoints
```
to put the sources on the local file system and the doing (essentially a slurm ```srun```)
```
cluster spack install -v py-entrypoints
```
the latter fails with a failed fetch of ```configparser@3.5```

Introducing 
```
depends_on('py-configparser@3.5:', when='^python@2.7', type=('build', 'run'))
```
for ```py-entrypoints``` leads to
```
File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1316, in dag_hash
    self.to_node_dict(), default_flow_style=True, width=maxint)
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1357, in to_node_
dict
    ) for name, dspec in sorted(deps.items())
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1316, in dag_hash
    self.to_node_dict(), default_flow_style=True, width=maxint)
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1357, in to_node_
dict
    ) for name, dspec in sorted(deps.items())
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1316, in dag_hash
    self.to_node_dict(), default_flow_style=True, width=maxint)
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/spec.py", line 1331, in to_node_
dict
    d.update(self.versions.to_dict())
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/spack/version.py", line 651, in to_dic
t
    ('version', str(self[0]))
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/external/ordereddict_backport.py", lin
e 45, in __init__
    self.__update(*args, **kwds)
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/external/ordereddict_backport.py", lin
e 172, in update
    self[key] = value
  File "/wang/environment/software/jessie/spack/split_test/lib/spack/external/ordereddict_backport.py", lin
e 55, in __setitem__
    dict_setitem(self, key, value)
RuntimeError: maximum recursion depth exceeded while calling a Python object
```



Discussion:
Which version of Python are you trying to build with?
Ah sorry, it's a spack-build ```python@2.7.13~tk+ucs4```

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-configparser/package.py b/var/spack/repos/builtin/packages/py-configparser/package.py
--- a/var/spack/repos/builtin/packages/py-configparser/package.py
+++ b/var/spack/repos/builtin/packages/py-configparser/package.py
@@ -29,16 +29,13 @@ class PyConfigparser(PythonPackage):
     """This library brings the updated configparser from Python 3.5 to
     Python 2.6-3.5."""
 
-    homepage = "https://pypi.python.org/pypi/configparser"
-    url      = "https://pypi.python.org/packages/source/c/configparser/configparser-3.5.0.tar.gz"
+    homepage = "https://docs.python.org/3/library/configparser.html"
+    url      = "https://pypi.io/packages/source/c/configparser/configparser-3.5.0.tar.gz"
 
-    version('3.5.0', 'cfdd915a5b7a6c09917a64a573140538',
-            url="https://pypi.python.org/packages/7c/69/c2ce7e91c89dc073eb1aa74c0621c3eefbffe8216b3f9af9d3885265c01c/configparser-3.5.0.tar.gz")
+    version('3.5.0', 'cfdd915a5b7a6c09917a64a573140538')
 
-    depends_on('python@2.6:2.8,3.4:')
+    depends_on('py-setuptools', type='build')
 
     # This dependency breaks concretization
     # See https://github.com/LLNL/spack/issues/2793
-    # depends_on('py-ordereddict', when='^python@2.6:2.6.999', type=('build', 'run'))  # noqa
-
-    depends_on('py-setuptools', type='build')
+    # depends_on('py-ordereddict', when='^python@:2.6', type=('build', 'run'))
diff --git a/var/spack/repos/builtin/packages/py-entrypoints/package.py b/var/spack/repos/builtin/packages/py-entrypoints/package.py
--- a/var/spack/repos/builtin/packages/py-entrypoints/package.py
+++ b/var/spack/repos/builtin/packages/py-entrypoints/package.py
@@ -25,15 +25,22 @@
 from spack import *
 
 
-class PyEntrypoints(Package):
+class PyEntrypoints(PythonPackage):
     """Discover and load entry points from installed packages."""
 
     homepage = "https://pypi.python.org/pypi/entrypoints"
-    url      = "https://files.pythonhosted.org/packages/f8/ad/0e77a853c745a15981ab51fa9a0cb4eca7a7a007b4c1970106ee6ba01e0c/entrypoints-0.2.2-py2.py3-none-any.whl"
+    url      = "https://pypi.python.org/packages/f8/ad/0e77a853c745a15981ab51fa9a0cb4eca7a7a007b4c1970106ee6ba01e0c/entrypoints-0.2.2-py2.py3-none-any.whl"
+
+    import_modules = ['entrypoints']
 
     version('0.2.2', '73bd7ce92c19b25dc5a20aff41be996a', expand=False)
 
+    depends_on('python@2.7:', type=('build', 'run'))
+
     depends_on('py-pip', type='build')
+    depends_on('py-configparser', when='^python@:2.8', type=('build', 'run'))
+
+    phases = ['install']
 
     def install(self, spec, prefix):
         pip = which('pip')
diff --git a/var/spack/repos/builtin/packages/py-ordereddict/package.py b/var/spack/repos/builtin/packages/py-ordereddict/package.py
--- a/var/spack/repos/builtin/packages/py-ordereddict/package.py
+++ b/var/spack/repos/builtin/packages/py-ordereddict/package.py
@@ -30,6 +30,8 @@ class PyOrdereddict(PythonPackage):
     OrderedDict that works in Python 2.4-2.6."""
 
     homepage = "https://pypi.python.org/pypi/ordereddict"
-    url      = "https://pypi.python.org/packages/source/o/ordereddict/ordereddict-1.1.tar.gz"
+    url      = "https://pypi.io/packages/source/o/ordereddict/ordereddict-1.1.tar.gz"
+
+    import_modules = ['ordereddict']
 
     version('1.1', 'a0ed854ee442051b249bfad0f638bbec')


Test patch: