summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2019-09-21 15:47:34 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2019-09-21 17:57:36 -0700
commit7a1dd517b8470ac3e01ff41075a076ef8aad5e44 (patch)
tree9a678124a11f84db727f57faac35353119350d65
parentef652ee42ad425c58c711a848d8c3af946281565 (diff)
downloadspack-7a1dd517b8470ac3e01ff41075a076ef8aad5e44.tar.gz
spack-7a1dd517b8470ac3e01ff41075a076ef8aad5e44.tar.bz2
spack-7a1dd517b8470ac3e01ff41075a076ef8aad5e44.tar.xz
spack-7a1dd517b8470ac3e01ff41075a076ef8aad5e44.zip
externals: avoid importing requests in jsonschema
Spack doesn't need `requests`, and neither does `jsonschema`, but `jsonschema` tries to import it, and it'll succeed if `requests` is on your machine (which is likely, given how popular it is). This commit removes the import to improve Spack's startup time a bit. On a mac with SSD, the import of requests is ~28% of Spack's startup time when run as `spack --print-shell-vars sh,modules` (.069 / .25 seconds), which is what `setup-env.sh` runs. On a Linux cluster where Python is mounted from NFS, this reduces `setup-env.sh` source time from ~1s to .75s. Note: This issue will be eliminated if we upgrade to a newer `jsonschema` (we'd need to drop Python 2.6 for that). See https://github.com/Julian/jsonschema/pull/388.
-rw-r--r--lib/spack/external/jsonschema/validators.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/spack/external/jsonschema/validators.py b/lib/spack/external/jsonschema/validators.py
index 3e326844f4..30c3515398 100644
--- a/lib/spack/external/jsonschema/validators.py
+++ b/lib/spack/external/jsonschema/validators.py
@@ -4,10 +4,7 @@ import contextlib
import json
import numbers
-try:
- import requests
-except ImportError:
- requests = None
+requests = None
from jsonschema import _utils, _validators
from jsonschema.compat import (