We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Default Editor in Non-Interactive Mode
Hi,

with the latest updates in `develop` (tested: 790b06e0c363ce1598deb3bde217c4685701b61d) spack seems to require to know my `default editor` when installing software, even in non-interactive mode.

On the first call to `spack install` it now fails if *no editor is installed* on a system (which is quite often the case in docker images #4480):
```
Traceback (most recent call last):
  File "/home/src/spack/bin/spack", line 80, in <module>
    import spack.main  # noqa
  File "/home/src/spack/lib/spack/spack/__init__.py", line 227, in <module>
    default = default_editors[0]
NameError: name 'default_editors' is not defined
```

This was not required earlier this week, so it might have been introduced quite recently. IMHO, spack should not need to know my editor for such a task :) (only for `spack create`-like commands)
Don't immediately raise an error when an editor is not found.
Fixes #4526.

@ax3l 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lib/spack/spack/__init__.py`
Content:
```
1 # flake8: noqa
2 ##############################################################################
3 # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
4 # Produced at the Lawrence Livermore National Laboratory.
5 #
6 # This file is part of Spack.
7 # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
8 # LLNL-CODE-647188
9 #
10 # For details, see https://github.com/llnl/spack
11 # Please also see the NOTICE and LICENSE files for our notice and the LGPL.
12 #
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU Lesser General Public License (as
15 # published by the Free Software Foundation) version 2.1, February 1999.
16 #
17 # This program is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
20 # conditions of the GNU Lesser General Public License for more details.
21 #
22 # You should have received a copy of the GNU Lesser General Public
23 # License along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 ##############################################################################
26 import multiprocessing
27 import os
28 import sys
29 import tempfile
30 import getpass
31 from llnl.util.filesystem import *
32 import llnl.util.tty as tty
33 
34 #-----------------------------------------------------------------------------
35 # Variables describing how Spack is laid out in its prefix.
36 #-----------------------------------------------------------------------------
37 # This file lives in $prefix/lib/spack/spack/__file__
38 spack_root = ancestor(__file__, 4)
39 
40 # The spack script itself
41 spack_file = join_path(spack_root, "bin", "spack")
42 
43 # spack directory hierarchy
44 lib_path       = join_path(spack_root, "lib", "spack")
45 external_path  = join_path(lib_path, "external")
46 build_env_path = join_path(lib_path, "env")
47 module_path    = join_path(lib_path, "spack")
48 platform_path  = join_path(module_path, 'platforms')
49 compilers_path = join_path(module_path, "compilers")
50 build_systems_path = join_path(module_path, 'build_systems')
51 operating_system_path = join_path(module_path, 'operating_systems')
52 test_path      = join_path(module_path, "test")
53 hooks_path     = join_path(module_path, "hooks")
54 var_path       = join_path(spack_root, "var", "spack")
55 stage_path     = join_path(var_path, "stage")
56 repos_path     = join_path(var_path, "repos")
57 share_path     = join_path(spack_root, "share", "spack")
58 
59 # Paths to built-in Spack repositories.
60 packages_path      = join_path(repos_path, "builtin")
61 mock_packages_path = join_path(repos_path, "builtin.mock")
62 
63 # User configuration location
64 user_config_path = os.path.expanduser('~/.spack')
65 
66 prefix = spack_root
67 opt_path        = join_path(prefix, "opt")
68 etc_path        = join_path(prefix, "etc")
69 system_etc_path = '/etc'
70 
71 # GPG paths.
72 gpg_keys_path      = join_path(var_path, "gpg")
73 mock_gpg_data_path = join_path(var_path, "gpg.mock", "data")
74 mock_gpg_keys_path = join_path(var_path, "gpg.mock", "keys")
75 gpg_path           = join_path(opt_path, "spack", "gpg")
76 
77 
78 #-----------------------------------------------------------------------------
79 # Initial imports (only for use in this file -- see __all__ below.)
80 #-----------------------------------------------------------------------------
81 # These imports depend on the paths above, or on each other
82 # Group them here so it's easy to understand the order.
83 # TODO: refactor this stuff to be more init order agnostic.
84 import spack.repository
85 import spack.error
86 import spack.config
87 import spack.fetch_strategy
88 from spack.file_cache import FileCache
89 from spack.abi import ABI
90 from spack.concretize import DefaultConcretizer
91 from spack.version import Version
92 from spack.util.path import canonicalize_path
93 
94 
95 #-----------------------------------------------------------------------------
96 # Initialize various data structures & objects at the core of Spack.
97 #-----------------------------------------------------------------------------
98 # Version information
99 spack_version = Version("0.10.0")
100 
101 
102 # Set up the default packages database.
103 try:
104     repo = spack.repository.RepoPath()
105     sys.meta_path.append(repo)
106 except spack.error.SpackError as e:
107     tty.die('while initializing Spack RepoPath:', e.message)
108 
109 
110 # Tests ABI compatibility between packages
111 abi = ABI()
112 
113 
114 # This controls how things are concretized in spack.
115 # Replace it with a subclass if you want different
116 # policies.
117 concretizer = DefaultConcretizer()
118 
119 #-----------------------------------------------------------------------------
120 # config.yaml options
121 #-----------------------------------------------------------------------------
122 _config = spack.config.get_config('config')
123 
124 
125 # Path where downloaded source code is cached
126 cache_path = canonicalize_path(
127     _config.get('source_cache', join_path(var_path, "cache")))
128 fetch_cache = spack.fetch_strategy.FsCache(cache_path)
129 
130 
131 # cache for miscellaneous stuff.
132 misc_cache_path = canonicalize_path(
133     _config.get('misc_cache', join_path(user_config_path, 'cache')))
134 misc_cache = FileCache(misc_cache_path)
135 
136 
137 # If this is enabled, tools that use SSL should not verify
138 # certifiates. e.g., curl should use the -k option.
139 insecure = not _config.get('verify_ssl', True)
140 
141 
142 # Whether spack should allow installation of unsafe versions of software.
143 # "Unsafe" versions are ones it doesn't have a checksum for.
144 do_checksum = _config.get('checksum', True)
145 
146 
147 # If this is True, spack will not clean the environment to remove
148 # potentially harmful variables before builds.
149 dirty = _config.get('dirty', False)
150 
151 
152 # The number of jobs to use when building in parallel.
153 # By default, use all cores on the machine.
154 build_jobs = _config.get('build_jobs', multiprocessing.cpu_count())
155 
156 
157 #-----------------------------------------------------------------------------
158 # When packages call 'from spack import *', this extra stuff is brought in.
159 #
160 # Spack internal code should call 'import spack' and accesses other
161 # variables (spack.repo, paths, etc.) directly.
162 #
163 # TODO: maybe this should be separated out to build_environment.py?
164 # TODO: it's not clear where all the stuff that needs to be included in
165 #       packages should live.  This file is overloaded for spack core vs.
166 #       for packages.
167 #
168 #-----------------------------------------------------------------------------
169 __all__ = []
170 
171 from spack.package import Package, run_before, run_after, on_package_attributes
172 from spack.build_systems.makefile import MakefilePackage
173 from spack.build_systems.autotools import AutotoolsPackage
174 from spack.build_systems.cmake import CMakePackage
175 from spack.build_systems.waf import WafPackage
176 from spack.build_systems.python import PythonPackage
177 from spack.build_systems.r import RPackage
178 from spack.build_systems.perl import PerlPackage
179 
180 __all__ += [
181     'run_before',
182     'run_after',
183     'on_package_attributes',
184     'Package',
185     'MakefilePackage',
186     'AutotoolsPackage',
187     'CMakePackage',
188     'WafPackage',
189     'PythonPackage',
190     'RPackage',
191     'PerlPackage',
192 ]
193 
194 from spack.version import Version, ver
195 __all__ += ['Version', 'ver']
196 
197 from spack.spec import Spec, alldeps
198 __all__ += ['Spec', 'alldeps']
199 
200 from spack.multimethod import when
201 __all__ += ['when']
202 
203 import llnl.util.filesystem
204 from llnl.util.filesystem import *
205 __all__ += llnl.util.filesystem.__all__
206 
207 import spack.directives
208 from spack.directives import *
209 __all__ += spack.directives.__all__
210 
211 import spack.util.executable
212 from spack.util.executable import *
213 __all__ += spack.util.executable.__all__
214 
215 
216 # Set up the user's editor
217 # $EDITOR environment variable has the highest precedence
218 editor = os.environ.get('EDITOR')
219 
220 # if editor is not set, use some sensible defaults
221 if editor is not None:
222     editor = Executable(editor)
223 else:
224     editor = which('vim', 'vi', 'emacs', 'nano')
225 
226 if not editor:
227     default = default_editors[0]
228     msg  = 'Default text editor, {0}, not found.\n'.format(default)
229     msg += 'Please set the EDITOR environment variable to your preferred '
230     msg += 'text editor, or install {0}.'.format(default)
231     raise EnvironmentError(msg)
232 
233 from spack.package import \
234     install_dependency_symlinks, flatten_dependencies, \
235     DependencyConflictError, InstallError, ExternalPackageError
236 __all__ += [
237     'install_dependency_symlinks', 'flatten_dependencies',
238     'DependencyConflictError', 'InstallError', 'ExternalPackageError']
239 
240 # Add default values for attributes that would otherwise be modified from
241 # Spack main script
242 debug = False
243 spack_working_dir = None
244
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -223,12 +223,13 @@
 else:
     editor = which('vim', 'vi', 'emacs', 'nano')
 
+# If there is no editor, only raise an error if we actually try to use it.
 if not editor:
-    default = default_editors[0]
-    msg  = 'Default text editor, {0}, not found.\n'.format(default)
-    msg += 'Please set the EDITOR environment variable to your preferred '
-    msg += 'text editor, or install {0}.'.format(default)
-    raise EnvironmentError(msg)
+    def editor_not_found(*args, **kwargs):
+        raise EnvironmentError(
+            'No text editor found! Please set the EDITOR environment variable '
+            'to your preferred text editor.')
+    editor = editor_not_found
 
 from spack.package import \
     install_dependency_symlinks, flatten_dependencies, \

{"golden_diff": "diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py\n--- a/lib/spack/spack/__init__.py\n+++ b/lib/spack/spack/__init__.py\n@@ -223,12 +223,13 @@\n else:\n     editor = which('vim', 'vi', 'emacs', 'nano')\n \n+# If there is no editor, only raise an error if we actually try to use it.\n if not editor:\n-    default = default_editors[0]\n-    msg  = 'Default text editor, {0}, not found.\\n'.format(default)\n-    msg += 'Please set the EDITOR environment variable to your preferred '\n-    msg += 'text editor, or install {0}.'.format(default)\n-    raise EnvironmentError(msg)\n+    def editor_not_found(*args, **kwargs):\n+        raise EnvironmentError(\n+            'No text editor found! Please set the EDITOR environment variable '\n+            'to your preferred text editor.')\n+    editor = editor_not_found\n \n from spack.package import \\\n     install_dependency_symlinks, flatten_dependencies, \\\n", "issue": "Default Editor in Non-Interactive Mode\nHi,\r\n\r\nwith the latest updates in `develop` (tested: 790b06e0c363ce1598deb3bde217c4685701b61d) spack seems to require to know my `default editor` when installing software, even in non-interactive mode.\r\n\r\nOn the first call to `spack install` it now fails if *no editor is installed* on a system (which is quite often the case in docker images #4480):\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/src/spack/bin/spack\", line 80, in <module>\r\n    import spack.main  # noqa\r\n  File \"/home/src/spack/lib/spack/spack/__init__.py\", line 227, in <module>\r\n    default = default_editors[0]\r\nNameError: name 'default_editors' is not defined\r\n```\r\n\r\nThis was not required earlier this week, so it might have been introduced quite recently. IMHO, spack should not need to know my editor for such a task :) (only for `spack create`-like commands)\nDon't immediately raise an error when an editor is not found.\nFixes #4526.\r\n\r\n@ax3l \n", "before_files": [{"content": "# flake8: noqa\n##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Laboratory.\n#\n# This file is part of Spack.\n# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.\n# LLNL-CODE-647188\n#\n# For details, see https://github.com/llnl/spack\n# Please also see the NOTICE and LICENSE files for our notice and the LGPL.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License (as\n# published by the Free Software Foundation) version 2.1, February 1999.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and\n# conditions of the GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n##############################################################################\nimport multiprocessing\nimport os\nimport sys\nimport tempfile\nimport getpass\nfrom llnl.util.filesystem import *\nimport llnl.util.tty as tty\n\n#-----------------------------------------------------------------------------\n# Variables describing how Spack is laid out in its prefix.\n#-----------------------------------------------------------------------------\n# This file lives in $prefix/lib/spack/spack/__file__\nspack_root = ancestor(__file__, 4)\n\n# The spack script itself\nspack_file = join_path(spack_root, \"bin\", \"spack\")\n\n# spack directory hierarchy\nlib_path       = join_path(spack_root, \"lib\", \"spack\")\nexternal_path  = join_path(lib_path, \"external\")\nbuild_env_path = join_path(lib_path, \"env\")\nmodule_path    = join_path(lib_path, \"spack\")\nplatform_path  = join_path(module_path, 'platforms')\ncompilers_path = join_path(module_path, \"compilers\")\nbuild_systems_path = join_path(module_path, 'build_systems')\noperating_system_path = join_path(module_path, 'operating_systems')\ntest_path      = join_path(module_path, \"test\")\nhooks_path     = join_path(module_path, \"hooks\")\nvar_path       = join_path(spack_root, \"var\", \"spack\")\nstage_path     = join_path(var_path, \"stage\")\nrepos_path     = join_path(var_path, \"repos\")\nshare_path     = join_path(spack_root, \"share\", \"spack\")\n\n# Paths to built-in Spack repositories.\npackages_path      = join_path(repos_path, \"builtin\")\nmock_packages_path = join_path(repos_path, \"builtin.mock\")\n\n# User configuration location\nuser_config_path = os.path.expanduser('~/.spack')\n\nprefix = spack_root\nopt_path        = join_path(prefix, \"opt\")\netc_path        = join_path(prefix, \"etc\")\nsystem_etc_path = '/etc'\n\n# GPG paths.\ngpg_keys_path      = join_path(var_path, \"gpg\")\nmock_gpg_data_path = join_path(var_path, \"gpg.mock\", \"data\")\nmock_gpg_keys_path = join_path(var_path, \"gpg.mock\", \"keys\")\ngpg_path           = join_path(opt_path, \"spack\", \"gpg\")\n\n\n#-----------------------------------------------------------------------------\n# Initial imports (only for use in this file -- see __all__ below.)\n#-----------------------------------------------------------------------------\n# These imports depend on the paths above, or on each other\n# Group them here so it's easy to understand the order.\n# TODO: refactor this stuff to be more init order agnostic.\nimport spack.repository\nimport spack.error\nimport spack.config\nimport spack.fetch_strategy\nfrom spack.file_cache import FileCache\nfrom spack.abi import ABI\nfrom spack.concretize import DefaultConcretizer\nfrom spack.version import Version\nfrom spack.util.path import canonicalize_path\n\n\n#-----------------------------------------------------------------------------\n# Initialize various data structures & objects at the core of Spack.\n#-----------------------------------------------------------------------------\n# Version information\nspack_version = Version(\"0.10.0\")\n\n\n# Set up the default packages database.\ntry:\n    repo = spack.repository.RepoPath()\n    sys.meta_path.append(repo)\nexcept spack.error.SpackError as e:\n    tty.die('while initializing Spack RepoPath:', e.message)\n\n\n# Tests ABI compatibility between packages\nabi = ABI()\n\n\n# This controls how things are concretized in spack.\n# Replace it with a subclass if you want different\n# policies.\nconcretizer = DefaultConcretizer()\n\n#-----------------------------------------------------------------------------\n# config.yaml options\n#-----------------------------------------------------------------------------\n_config = spack.config.get_config('config')\n\n\n# Path where downloaded source code is cached\ncache_path = canonicalize_path(\n    _config.get('source_cache', join_path(var_path, \"cache\")))\nfetch_cache = spack.fetch_strategy.FsCache(cache_path)\n\n\n# cache for miscellaneous stuff.\nmisc_cache_path = canonicalize_path(\n    _config.get('misc_cache', join_path(user_config_path, 'cache')))\nmisc_cache = FileCache(misc_cache_path)\n\n\n# If this is enabled, tools that use SSL should not verify\n# certifiates. e.g., curl should use the -k option.\ninsecure = not _config.get('verify_ssl', True)\n\n\n# Whether spack should allow installation of unsafe versions of software.\n# \"Unsafe\" versions are ones it doesn't have a checksum for.\ndo_checksum = _config.get('checksum', True)\n\n\n# If this is True, spack will not clean the environment to remove\n# potentially harmful variables before builds.\ndirty = _config.get('dirty', False)\n\n\n# The number of jobs to use when building in parallel.\n# By default, use all cores on the machine.\nbuild_jobs = _config.get('build_jobs', multiprocessing.cpu_count())\n\n\n#-----------------------------------------------------------------------------\n# When packages call 'from spack import *', this extra stuff is brought in.\n#\n# Spack internal code should call 'import spack' and accesses other\n# variables (spack.repo, paths, etc.) directly.\n#\n# TODO: maybe this should be separated out to build_environment.py?\n# TODO: it's not clear where all the stuff that needs to be included in\n#       packages should live.  This file is overloaded for spack core vs.\n#       for packages.\n#\n#-----------------------------------------------------------------------------\n__all__ = []\n\nfrom spack.package import Package, run_before, run_after, on_package_attributes\nfrom spack.build_systems.makefile import MakefilePackage\nfrom spack.build_systems.autotools import AutotoolsPackage\nfrom spack.build_systems.cmake import CMakePackage\nfrom spack.build_systems.waf import WafPackage\nfrom spack.build_systems.python import PythonPackage\nfrom spack.build_systems.r import RPackage\nfrom spack.build_systems.perl import PerlPackage\n\n__all__ += [\n    'run_before',\n    'run_after',\n    'on_package_attributes',\n    'Package',\n    'MakefilePackage',\n    'AutotoolsPackage',\n    'CMakePackage',\n    'WafPackage',\n    'PythonPackage',\n    'RPackage',\n    'PerlPackage',\n]\n\nfrom spack.version import Version, ver\n__all__ += ['Version', 'ver']\n\nfrom spack.spec import Spec, alldeps\n__all__ += ['Spec', 'alldeps']\n\nfrom spack.multimethod import when\n__all__ += ['when']\n\nimport llnl.util.filesystem\nfrom llnl.util.filesystem import *\n__all__ += llnl.util.filesystem.__all__\n\nimport spack.directives\nfrom spack.directives import *\n__all__ += spack.directives.__all__\n\nimport spack.util.executable\nfrom spack.util.executable import *\n__all__ += spack.util.executable.__all__\n\n\n# Set up the user's editor\n# $EDITOR environment variable has the highest precedence\neditor = os.environ.get('EDITOR')\n\n# if editor is not set, use some sensible defaults\nif editor is not None:\n    editor = Executable(editor)\nelse:\n    editor = which('vim', 'vi', 'emacs', 'nano')\n\nif not editor:\n    default = default_editors[0]\n    msg  = 'Default text editor, {0}, not found.\\n'.format(default)\n    msg += 'Please set the EDITOR environment variable to your preferred '\n    msg += 'text editor, or install {0}.'.format(default)\n    raise EnvironmentError(msg)\n\nfrom spack.package import \\\n    install_dependency_symlinks, flatten_dependencies, \\\n    DependencyConflictError, InstallError, ExternalPackageError\n__all__ += [\n    'install_dependency_symlinks', 'flatten_dependencies',\n    'DependencyConflictError', 'InstallError', 'ExternalPackageError']\n\n# Add default values for attributes that would otherwise be modified from\n# Spack main script\ndebug = False\nspack_working_dir = None\n", "path": "lib/spack/spack/__init__.py"}], "after_files": [{"content": "# flake8: noqa\n##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Laboratory.\n#\n# This file is part of Spack.\n# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.\n# LLNL-CODE-647188\n#\n# For details, see https://github.com/llnl/spack\n# Please also see the NOTICE and LICENSE files for our notice and the LGPL.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License (as\n# published by the Free Software Foundation) version 2.1, February 1999.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and\n# conditions of the GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n##############################################################################\nimport multiprocessing\nimport os\nimport sys\nimport tempfile\nimport getpass\nfrom llnl.util.filesystem import *\nimport llnl.util.tty as tty\n\n#-----------------------------------------------------------------------------\n# Variables describing how Spack is laid out in its prefix.\n#-----------------------------------------------------------------------------\n# This file lives in $prefix/lib/spack/spack/__file__\nspack_root = ancestor(__file__, 4)\n\n# The spack script itself\nspack_file = join_path(spack_root, \"bin\", \"spack\")\n\n# spack directory hierarchy\nlib_path       = join_path(spack_root, \"lib\", \"spack\")\nexternal_path  = join_path(lib_path, \"external\")\nbuild_env_path = join_path(lib_path, \"env\")\nmodule_path    = join_path(lib_path, \"spack\")\nplatform_path  = join_path(module_path, 'platforms')\ncompilers_path = join_path(module_path, \"compilers\")\nbuild_systems_path = join_path(module_path, 'build_systems')\noperating_system_path = join_path(module_path, 'operating_systems')\ntest_path      = join_path(module_path, \"test\")\nhooks_path     = join_path(module_path, \"hooks\")\nvar_path       = join_path(spack_root, \"var\", \"spack\")\nstage_path     = join_path(var_path, \"stage\")\nrepos_path     = join_path(var_path, \"repos\")\nshare_path     = join_path(spack_root, \"share\", \"spack\")\n\n# Paths to built-in Spack repositories.\npackages_path      = join_path(repos_path, \"builtin\")\nmock_packages_path = join_path(repos_path, \"builtin.mock\")\n\n# User configuration location\nuser_config_path = os.path.expanduser('~/.spack')\n\nprefix = spack_root\nopt_path        = join_path(prefix, \"opt\")\netc_path        = join_path(prefix, \"etc\")\nsystem_etc_path = '/etc'\n\n# GPG paths.\ngpg_keys_path      = join_path(var_path, \"gpg\")\nmock_gpg_data_path = join_path(var_path, \"gpg.mock\", \"data\")\nmock_gpg_keys_path = join_path(var_path, \"gpg.mock\", \"keys\")\ngpg_path           = join_path(opt_path, \"spack\", \"gpg\")\n\n\n#-----------------------------------------------------------------------------\n# Initial imports (only for use in this file -- see __all__ below.)\n#-----------------------------------------------------------------------------\n# These imports depend on the paths above, or on each other\n# Group them here so it's easy to understand the order.\n# TODO: refactor this stuff to be more init order agnostic.\nimport spack.repository\nimport spack.error\nimport spack.config\nimport spack.fetch_strategy\nfrom spack.file_cache import FileCache\nfrom spack.abi import ABI\nfrom spack.concretize import DefaultConcretizer\nfrom spack.version import Version\nfrom spack.util.path import canonicalize_path\n\n\n#-----------------------------------------------------------------------------\n# Initialize various data structures & objects at the core of Spack.\n#-----------------------------------------------------------------------------\n# Version information\nspack_version = Version(\"0.10.0\")\n\n\n# Set up the default packages database.\ntry:\n    repo = spack.repository.RepoPath()\n    sys.meta_path.append(repo)\nexcept spack.error.SpackError as e:\n    tty.die('while initializing Spack RepoPath:', e.message)\n\n\n# Tests ABI compatibility between packages\nabi = ABI()\n\n\n# This controls how things are concretized in spack.\n# Replace it with a subclass if you want different\n# policies.\nconcretizer = DefaultConcretizer()\n\n#-----------------------------------------------------------------------------\n# config.yaml options\n#-----------------------------------------------------------------------------\n_config = spack.config.get_config('config')\n\n\n# Path where downloaded source code is cached\ncache_path = canonicalize_path(\n    _config.get('source_cache', join_path(var_path, \"cache\")))\nfetch_cache = spack.fetch_strategy.FsCache(cache_path)\n\n\n# cache for miscellaneous stuff.\nmisc_cache_path = canonicalize_path(\n    _config.get('misc_cache', join_path(user_config_path, 'cache')))\nmisc_cache = FileCache(misc_cache_path)\n\n\n# If this is enabled, tools that use SSL should not verify\n# certifiates. e.g., curl should use the -k option.\ninsecure = not _config.get('verify_ssl', True)\n\n\n# Whether spack should allow installation of unsafe versions of software.\n# \"Unsafe\" versions are ones it doesn't have a checksum for.\ndo_checksum = _config.get('checksum', True)\n\n\n# If this is True, spack will not clean the environment to remove\n# potentially harmful variables before builds.\ndirty = _config.get('dirty', False)\n\n\n# The number of jobs to use when building in parallel.\n# By default, use all cores on the machine.\nbuild_jobs = _config.get('build_jobs', multiprocessing.cpu_count())\n\n\n#-----------------------------------------------------------------------------\n# When packages call 'from spack import *', this extra stuff is brought in.\n#\n# Spack internal code should call 'import spack' and accesses other\n# variables (spack.repo, paths, etc.) directly.\n#\n# TODO: maybe this should be separated out to build_environment.py?\n# TODO: it's not clear where all the stuff that needs to be included in\n#       packages should live.  This file is overloaded for spack core vs.\n#       for packages.\n#\n#-----------------------------------------------------------------------------\n__all__ = []\n\nfrom spack.package import Package, run_before, run_after, on_package_attributes\nfrom spack.build_systems.makefile import MakefilePackage\nfrom spack.build_systems.autotools import AutotoolsPackage\nfrom spack.build_systems.cmake import CMakePackage\nfrom spack.build_systems.waf import WafPackage\nfrom spack.build_systems.python import PythonPackage\nfrom spack.build_systems.r import RPackage\nfrom spack.build_systems.perl import PerlPackage\n\n__all__ += [\n    'run_before',\n    'run_after',\n    'on_package_attributes',\n    'Package',\n    'MakefilePackage',\n    'AutotoolsPackage',\n    'CMakePackage',\n    'WafPackage',\n    'PythonPackage',\n    'RPackage',\n    'PerlPackage',\n]\n\nfrom spack.version import Version, ver\n__all__ += ['Version', 'ver']\n\nfrom spack.spec import Spec, alldeps\n__all__ += ['Spec', 'alldeps']\n\nfrom spack.multimethod import when\n__all__ += ['when']\n\nimport llnl.util.filesystem\nfrom llnl.util.filesystem import *\n__all__ += llnl.util.filesystem.__all__\n\nimport spack.directives\nfrom spack.directives import *\n__all__ += spack.directives.__all__\n\nimport spack.util.executable\nfrom spack.util.executable import *\n__all__ += spack.util.executable.__all__\n\n\n# Set up the user's editor\n# $EDITOR environment variable has the highest precedence\neditor = os.environ.get('EDITOR')\n\n# if editor is not set, use some sensible defaults\nif editor is not None:\n    editor = Executable(editor)\nelse:\n    editor = which('vim', 'vi', 'emacs', 'nano')\n\n# If there is no editor, only raise an error if we actually try to use it.\nif not editor:\n    def editor_not_found(*args, **kwargs):\n        raise EnvironmentError(\n            'No text editor found! Please set the EDITOR environment variable '\n            'to your preferred text editor.')\n    editor = editor_not_found\n\nfrom spack.package import \\\n    install_dependency_symlinks, flatten_dependencies, \\\n    DependencyConflictError, InstallError, ExternalPackageError\n__all__ += [\n    'install_dependency_symlinks', 'flatten_dependencies',\n    'DependencyConflictError', 'InstallError', 'ExternalPackageError']\n\n# Add default values for attributes that would otherwise be modified from\n# Spack main script\ndebug = False\nspack_working_dir = None\n", "path": "lib/spack/spack/__init__.py"}]}