summaryrefslogtreecommitdiff
path: root/lib/spack/spack/spec.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/spec.py')
-rw-r--r--lib/spack/spack/spec.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index fc4bf41e34..37a3cf4d7e 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -98,7 +98,7 @@ expansion when it is the first character in an id typed on the command line.
import base64
import hashlib
import imp
-import sys
+import ctypes
from StringIO import StringIO
from operator import attrgetter
@@ -203,6 +203,9 @@ special_types = {
legal_deps = tuple(special_types) + alldeps
+"""Max integer helps avoid passing too large a value to cyaml."""
+maxint = 2 ** (ctypes.sizeof(ctypes.c_int) * 8 - 1) - 1
+
def validate_deptype(deptype):
if isinstance(deptype, str):
@@ -969,7 +972,7 @@ class Spec(object):
return self._hash[:length]
else:
yaml_text = syaml.dump(
- self.to_node_dict(), default_flow_style=True, width=sys.maxint)
+ self.to_node_dict(), default_flow_style=True, width=maxint)
sha = hashlib.sha1(yaml_text)
b32_hash = base64.b32encode(sha.digest()).lower()[:length]
if self.concrete: