imports: remove unnecessary import spack
statements
- remove most `import spack` statements, except for files that need `spack_version` - import spack is no longer sufficient to use submodules (e.g. spack.directives). - these submodules must be imported directly. Update references accordingly.
This commit is contained in:
parent
6b2c49648a
commit
8d7873e8b2
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
from llnl.util.lang import memoized
|
from llnl.util.lang import memoized
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.spec
|
import spack.spec
|
||||||
from spack.build_environment import dso_suffix
|
from spack.build_environment import dso_suffix
|
||||||
from spack.spec import CompilerSpec
|
from spack.spec import CompilerSpec
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import tarfile
|
import tarfile
|
||||||
@ -37,7 +36,6 @@
|
|||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.filesystem import mkdirp, install_tree
|
from llnl.util.filesystem import mkdirp, install_tree
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.fetch_strategy as fs
|
import spack.fetch_strategy as fs
|
||||||
import spack.util.gpg as gpg_util
|
import spack.util.gpg as gpg_util
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import spack
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
from spack.directory_layout import YamlViewExtensionsLayout
|
from spack.directory_layout import YamlViewExtensionsLayout
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import spack
|
from llnl.util.filesystem import mkdirp
|
||||||
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.util.web
|
import spack.util.web
|
||||||
from llnl.util.filesystem import mkdirp
|
|
||||||
import spack.repo
|
import spack.repo
|
||||||
from spack.spec import Spec
|
from spack.spec import Spec
|
||||||
from spack.util.executable import which, ProcessError
|
from spack.util.executable import which, ProcessError
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.store
|
import spack.store
|
||||||
from spack.directory_layout import YamlViewExtensionsLayout
|
from spack.directory_layout import YamlViewExtensionsLayout
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
import spack
|
import spack
|
||||||
|
|
||||||
|
|
||||||
description = "launch an interpreter as spack would launch a command"
|
description = "launch an interpreter as spack would launch a command"
|
||||||
section = "developer"
|
section = "developer"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
@ -22,10 +22,9 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import spack
|
|
||||||
import spack.store
|
import spack.store
|
||||||
description = "rebuild Spack's package database"
|
|
||||||
|
|
||||||
|
description = "rebuild Spack's package database"
|
||||||
section = "admin"
|
section = "admin"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import spack
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.cmd.common.arguments as arguments
|
import spack.cmd.common.arguments as arguments
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.store
|
import spack.store
|
||||||
import spack.repo
|
import spack.repo
|
||||||
|
@ -52,13 +52,14 @@
|
|||||||
YamlFilesystemView.
|
YamlFilesystemView.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import spack
|
|
||||||
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.store
|
import spack.store
|
||||||
from spack.filesystem_view import YamlFilesystemView
|
from spack.filesystem_view import YamlFilesystemView
|
||||||
import llnl.util.tty as tty
|
|
||||||
|
|
||||||
description = "produce a single-rooted directory view of packages"
|
description = "produce a single-rooted directory view of packages"
|
||||||
section = "environment"
|
section = "environment"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"""
|
"""
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
||||||
import spack
|
import spack.spec
|
||||||
|
|
||||||
|
|
||||||
#: The types of dependency relationships that Spack understands.
|
#: The types of dependency relationships that Spack understands.
|
||||||
|
@ -55,16 +55,14 @@ class OpenMpi(Package):
|
|||||||
|
|
||||||
import llnl.util.lang
|
import llnl.util.lang
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.error
|
import spack.error
|
||||||
import spack.spec
|
import spack.spec
|
||||||
import spack.url
|
import spack.url
|
||||||
|
import spack.variant
|
||||||
from spack.dependency import Dependency, default_deptype, canonical_deptype
|
from spack.dependency import Dependency, default_deptype, canonical_deptype
|
||||||
from spack.fetch_strategy import from_kwargs
|
from spack.fetch_strategy import from_kwargs
|
||||||
from spack.patch import Patch
|
from spack.patch import Patch
|
||||||
from spack.resource import Resource
|
from spack.resource import Resource
|
||||||
from spack.spec import Spec, parse_anonymous_spec
|
|
||||||
from spack.variant import Variant
|
|
||||||
from spack.version import Version
|
from spack.version import Version
|
||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
@ -265,9 +263,9 @@ def _depends_on(pkg, spec, when=None, type=default_deptype, patches=None):
|
|||||||
# If when is None or True make sure the condition is always satisfied
|
# If when is None or True make sure the condition is always satisfied
|
||||||
if when is None or when is True:
|
if when is None or when is True:
|
||||||
when = pkg.name
|
when = pkg.name
|
||||||
when_spec = parse_anonymous_spec(when, pkg.name)
|
when_spec = spack.spec.parse_anonymous_spec(when, pkg.name)
|
||||||
|
|
||||||
dep_spec = Spec(spec)
|
dep_spec = spack.spec.Spec(spec)
|
||||||
if pkg.name == dep_spec.name:
|
if pkg.name == dep_spec.name:
|
||||||
raise CircularReferenceError(
|
raise CircularReferenceError(
|
||||||
"Package '%s' cannot depend on itself." % pkg.name)
|
"Package '%s' cannot depend on itself." % pkg.name)
|
||||||
@ -328,7 +326,7 @@ def conflicts(conflict_spec, when=None, msg=None):
|
|||||||
def _execute_conflicts(pkg):
|
def _execute_conflicts(pkg):
|
||||||
# If when is not specified the conflict always holds
|
# If when is not specified the conflict always holds
|
||||||
condition = pkg.name if when is None else when
|
condition = pkg.name if when is None else when
|
||||||
when_spec = parse_anonymous_spec(condition, pkg.name)
|
when_spec = spack.spec.parse_anonymous_spec(condition, pkg.name)
|
||||||
|
|
||||||
# Save in a list the conflicts and the associated custom messages
|
# Save in a list the conflicts and the associated custom messages
|
||||||
when_spec_list = pkg.conflicts.setdefault(conflict_spec, [])
|
when_spec_list = pkg.conflicts.setdefault(conflict_spec, [])
|
||||||
@ -382,7 +380,7 @@ def _execute_extends(pkg):
|
|||||||
|
|
||||||
when = kwargs.get('when', pkg.name)
|
when = kwargs.get('when', pkg.name)
|
||||||
_depends_on(pkg, spec, when=when)
|
_depends_on(pkg, spec, when=when)
|
||||||
pkg.extendees[spec] = (Spec(spec), kwargs)
|
pkg.extendees[spec] = (spack.spec.Spec(spec), kwargs)
|
||||||
return _execute_extends
|
return _execute_extends
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +392,7 @@ def provides(*specs, **kwargs):
|
|||||||
"""
|
"""
|
||||||
def _execute_provides(pkg):
|
def _execute_provides(pkg):
|
||||||
spec_string = kwargs.get('when', pkg.name)
|
spec_string = kwargs.get('when', pkg.name)
|
||||||
provider_spec = parse_anonymous_spec(spec_string, pkg.name)
|
provider_spec = spack.spec.parse_anonymous_spec(spec_string, pkg.name)
|
||||||
|
|
||||||
for string in specs:
|
for string in specs:
|
||||||
for provided_spec in spack.spec.parse(string):
|
for provided_spec in spack.spec.parse(string):
|
||||||
@ -431,7 +429,8 @@ def patch(url_or_filename, level=1, when=None, working_dir=".", **kwargs):
|
|||||||
"""
|
"""
|
||||||
def _execute_patch(pkg_or_dep):
|
def _execute_patch(pkg_or_dep):
|
||||||
constraint = pkg_or_dep.name if when is None else when
|
constraint = pkg_or_dep.name if when is None else when
|
||||||
when_spec = parse_anonymous_spec(constraint, pkg_or_dep.name)
|
when_spec = spack.spec.parse_anonymous_spec(
|
||||||
|
constraint, pkg_or_dep.name)
|
||||||
|
|
||||||
# if this spec is identical to some other, then append this
|
# if this spec is identical to some other, then append this
|
||||||
# patch to the existing list.
|
# patch to the existing list.
|
||||||
@ -491,7 +490,7 @@ def _execute_variant(pkg):
|
|||||||
msg = "Invalid variant name in {0}: '{1}'"
|
msg = "Invalid variant name in {0}: '{1}'"
|
||||||
raise DirectiveError(directive, msg.format(pkg.name, name))
|
raise DirectiveError(directive, msg.format(pkg.name, name))
|
||||||
|
|
||||||
pkg.variants[name] = Variant(
|
pkg.variants[name] = spack.variant.Variant(
|
||||||
name, default, description, values, multi, validator
|
name, default, description, values, multi, validator
|
||||||
)
|
)
|
||||||
return _execute_variant
|
return _execute_variant
|
||||||
@ -538,7 +537,7 @@ def _execute_resource(pkg):
|
|||||||
message += "\tdestination : '{dest}'\n".format(dest=destination)
|
message += "\tdestination : '{dest}'\n".format(dest=destination)
|
||||||
raise RuntimeError(message)
|
raise RuntimeError(message)
|
||||||
|
|
||||||
when_spec = parse_anonymous_spec(when, pkg.name)
|
when_spec = spack.spec.parse_anonymous_spec(when, pkg.name)
|
||||||
resources = pkg.resources.setdefault(when_spec, [])
|
resources = pkg.resources.setdefault(when_spec, [])
|
||||||
name = kwargs.get('name')
|
name = kwargs.get('name')
|
||||||
fetcher = from_kwargs(**kwargs)
|
fetcher = from_kwargs(**kwargs)
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
from llnl.util.link_tree import LinkTree
|
from llnl.util.link_tree import LinkTree
|
||||||
from llnl.util import tty
|
from llnl.util import tty
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.spec
|
import spack.spec
|
||||||
import spack.store
|
import spack.store
|
||||||
from spack.directory_layout import ExtensionAlreadyInstalledError
|
from spack.directory_layout import ExtensionAlreadyInstalledError
|
||||||
|
@ -24,10 +24,11 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import spack
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.filesystem import mkdirp
|
from llnl.util.filesystem import mkdirp
|
||||||
|
|
||||||
|
from spack.util.editor import editor
|
||||||
|
|
||||||
|
|
||||||
def pre_install(spec):
|
def pre_install(spec):
|
||||||
"""This hook handles global license setup for licensed software."""
|
"""This hook handles global license setup for licensed software."""
|
||||||
@ -55,7 +56,7 @@ def set_up_license(pkg):
|
|||||||
# Create a new license file
|
# Create a new license file
|
||||||
write_license_file(pkg, license_path)
|
write_license_file(pkg, license_path)
|
||||||
# Open up file in user's favorite $EDITOR for editing
|
# Open up file in user's favorite $EDITOR for editing
|
||||||
spack.editor(license_path)
|
editor(license_path)
|
||||||
tty.msg("Added global license file %s" % license_path)
|
tty.msg("Added global license file %s" % license_path)
|
||||||
else:
|
else:
|
||||||
# Use already existing license file
|
# Use already existing license file
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.error
|
import spack.error
|
||||||
import spack.fetch_strategy as fs
|
import spack.fetch_strategy as fs
|
||||||
import spack.stage
|
import spack.stage
|
||||||
|
@ -29,12 +29,10 @@
|
|||||||
from six import iteritems
|
from six import iteritems
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
|
||||||
|
import spack.error
|
||||||
import spack.util.spack_yaml as syaml
|
import spack.util.spack_yaml as syaml
|
||||||
from yaml.error import MarkedYAMLError
|
from yaml.error import MarkedYAMLError
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.error
|
|
||||||
|
|
||||||
|
|
||||||
class ProviderIndex(object):
|
class ProviderIndex(object):
|
||||||
"""This is a dict of dicts used for finding providers of particular
|
"""This is a dict of dicts used for finding providers of particular
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.filesystem import mkdirp, install
|
from llnl.util.filesystem import mkdirp, install
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.config
|
import spack.config
|
||||||
import spack.caches
|
import spack.caches
|
||||||
import spack.error
|
import spack.error
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import platform as py_platform
|
import platform as py_platform
|
||||||
import spack
|
|
||||||
import spack.architecture
|
import spack.architecture
|
||||||
from spack.spec import Spec
|
from spack.spec import Spec
|
||||||
from spack.platforms.cray import Cray
|
from spack.platforms.cray import Cray
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import spack
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import spack.repo
|
import spack.repo
|
||||||
|
@ -23,12 +23,11 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from llnl.util.tty.color import color_when
|
from llnl.util.tty.color import color_when
|
||||||
|
|
||||||
import spack
|
import spack.store
|
||||||
from spack.main import SpackCommand
|
from spack.main import SpackCommand
|
||||||
|
|
||||||
dependencies = SpackCommand('dependencies')
|
dependencies = SpackCommand('dependencies')
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
from llnl.util.tty.color import color_when
|
from llnl.util.tty.color import color_when
|
||||||
|
|
||||||
import spack
|
import spack.store
|
||||||
from spack.main import SpackCommand
|
from spack.main import SpackCommand
|
||||||
|
|
||||||
dependents = SpackCommand('dependents')
|
dependents = SpackCommand('dependents')
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
import llnl.util.filesystem as fs
|
import llnl.util.filesystem as fs
|
||||||
|
|
||||||
import spack
|
|
||||||
import spack.config
|
import spack.config
|
||||||
import spack.package
|
import spack.package
|
||||||
import spack.cmd.install
|
import spack.cmd.install
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
These tests check Spec DAG operations using dummy packages.
|
These tests check Spec DAG operations using dummy packages.
|
||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
import spack
|
|
||||||
import spack.architecture
|
import spack.architecture
|
||||||
import spack.package
|
import spack.package
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
import spack
|
import spack.store
|
||||||
import spack.spec as sp
|
import spack.spec as sp
|
||||||
from spack.parse import Token
|
from spack.parse import Token
|
||||||
from spack.spec import Spec, parse, parse_anonymous_spec
|
from spack.spec import Spec, parse, parse_anonymous_spec
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import spack
|
import spack.spec
|
||||||
from spack.directory_layout import YamlDirectoryLayout
|
from spack.directory_layout import YamlDirectoryLayout
|
||||||
from spack.filesystem_view import YamlFilesystemView
|
from spack.filesystem_view import YamlFilesystemView
|
||||||
|
|
||||||
|
@ -29,11 +29,12 @@
|
|||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import re
|
||||||
|
from six import StringIO
|
||||||
|
|
||||||
import llnl.util.lang as lang
|
import llnl.util.lang as lang
|
||||||
import spack
|
|
||||||
|
import spack.directives
|
||||||
import spack.error as error
|
import spack.error as error
|
||||||
from six import StringIO
|
|
||||||
|
|
||||||
|
|
||||||
class Variant(object):
|
class Variant(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user