From 7dd79094b05172cfcd2b594326eb22bf8e3c83cd Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 23 Oct 2017 14:23:00 +0200 Subject: [PATCH] remove wildcards from make spack core and packages - This removes all wildcard imports EXCEPT `from spack import *` in packages --- lib/spack/llnl/util/link_tree.py | 3 ++- lib/spack/llnl/util/tty/__init__.py | 2 +- lib/spack/spack/__init__.py | 5 +++-- lib/spack/spack/build_environment.py | 6 +++--- lib/spack/spack/build_systems/autotools.py | 5 ++--- lib/spack/spack/cmd/__init__.py | 6 +++--- lib/spack/spack/cmd/build.py | 8 +++++++- lib/spack/spack/cmd/checksum.py | 4 ++-- lib/spack/spack/cmd/configure.py | 7 ++++++- lib/spack/spack/cmd/create.py | 6 ++++-- lib/spack/spack/cmd/fetch.py | 2 ++ lib/spack/spack/cmd/flake8.py | 4 ++-- lib/spack/spack/cmd/graph.py | 5 ++--- lib/spack/spack/cmd/help.py | 2 +- lib/spack/spack/cmd/info.py | 2 +- lib/spack/spack/cmd/pkg.py | 2 +- lib/spack/spack/cmd/repo.py | 2 +- lib/spack/spack/cmd/test.py | 2 +- lib/spack/spack/cmd/url.py | 6 +++++- lib/spack/spack/compiler.py | 2 +- lib/spack/spack/compilers/cce.py | 2 +- lib/spack/spack/compilers/clang.py | 19 ++++++++++--------- lib/spack/spack/compilers/gcc.py | 4 +++- lib/spack/spack/compilers/intel.py | 3 ++- lib/spack/spack/compilers/nag.py | 2 +- lib/spack/spack/compilers/pgi.py | 2 +- lib/spack/spack/compilers/xl.py | 3 ++- lib/spack/spack/compilers/xl_r.py | 3 ++- lib/spack/spack/concretize.py | 9 +++++---- lib/spack/spack/database.py | 4 ++-- lib/spack/spack/directives.py | 2 +- lib/spack/spack/fetch_strategy.py | 10 +++++----- lib/spack/spack/file_cache.py | 4 ++-- lib/spack/spack/graph.py | 11 ++++++----- lib/spack/spack/hooks/case_consistency.py | 4 ++-- lib/spack/spack/main.py | 1 - lib/spack/spack/mirror.py | 4 ++-- lib/spack/spack/multimethod.py | 2 +- lib/spack/spack/operating_systems/cnl.py | 6 ++++-- lib/spack/spack/operating_systems/mac_os.py | 3 ++- lib/spack/spack/package.py | 8 +++++--- lib/spack/spack/package_prefs.py | 2 +- lib/spack/spack/package_test.py | 2 +- lib/spack/spack/parse.py | 1 + lib/spack/spack/repository.py | 5 +++-- lib/spack/spack/spec.py | 18 ++++++++++++------ lib/spack/spack/stage.py | 4 ++-- lib/spack/spack/test/cc.py | 4 ++-- lib/spack/spack/test/cmd/flake8.py | 4 ++-- lib/spack/spack/test/cmd/list.py | 2 +- lib/spack/spack/test/cmd/url.py | 3 ++- lib/spack/spack/test/conftest.py | 5 +++-- lib/spack/spack/test/database.py | 7 ++++--- lib/spack/spack/test/directory_layout.py | 8 +++++--- lib/spack/spack/test/git_fetch.py | 2 +- lib/spack/spack/test/hg_fetch.py | 2 +- lib/spack/spack/test/llnl/util/lang.py | 2 +- lib/spack/spack/test/llnl/util/link_tree.py | 2 +- lib/spack/spack/test/llnl/util/lock.py | 2 +- lib/spack/spack/test/make_executable.py | 2 +- lib/spack/spack/test/module_parsing.py | 6 +++++- lib/spack/spack/test/multimethod.py | 3 +-- lib/spack/spack/test/packages.py | 2 +- lib/spack/spack/test/packaging.py | 5 ++++- lib/spack/spack/test/sbang.py | 4 ++-- lib/spack/spack/test/spec_dag.py | 2 +- lib/spack/spack/test/spec_semantics.py | 6 ++++-- lib/spack/spack/test/spec_syntax.py | 7 ++++++- lib/spack/spack/test/svn_fetch.py | 2 +- lib/spack/spack/test/url_fetch.py | 2 +- lib/spack/spack/test/url_parse.py | 8 ++++++-- lib/spack/spack/test/variant.py | 7 ++++++- lib/spack/spack/test/versions.py | 2 +- lib/spack/spack/test/web.py | 2 +- lib/spack/spack/url.py | 2 +- lib/spack/spack/util/spack_yaml.py | 2 +- .../repos/builtin/packages/atlas/package.py | 6 +++--- .../builtin/packages/foam-extend/package.py | 10 ++++++---- .../packages/of-adios-write/package.py | 8 ++++---- .../builtin/packages/openblas/package.py | 7 ++++--- .../builtin/packages/openfoam-com/package.py | 8 ++++---- .../builtin/packages/openfoam-org/package.py | 14 +++++++++----- .../repos/builtin/packages/pocl/package.py | 4 ++-- .../repos/builtin/packages/python/package.py | 9 ++++----- var/spack/repos/builtin/packages/r/package.py | 4 +--- 85 files changed, 233 insertions(+), 163 deletions(-) diff --git a/lib/spack/llnl/util/link_tree.py b/lib/spack/llnl/util/link_tree.py index 6f6dabe430..49ee03c1ca 100644 --- a/lib/spack/llnl/util/link_tree.py +++ b/lib/spack/llnl/util/link_tree.py @@ -26,7 +26,8 @@ import os import shutil -from llnl.util.filesystem import * + +from llnl.util.filesystem import traverse_tree, mkdirp, touch __all__ = ['LinkTree'] diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py index 9a0f1c8438..ac51d201aa 100644 --- a/lib/spack/llnl/util/tty/__init__.py +++ b/lib/spack/llnl/util/tty/__init__.py @@ -32,7 +32,7 @@ from six import StringIO from six.moves import input -from llnl.util.tty.color import * +from llnl.util.tty.color import cprint, cwrite, cescape, clen _debug = False _verbose = False diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index 19590b6790..f7fa9ca836 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -90,7 +90,7 @@ from spack.concretize import DefaultConcretizer from spack.version import Version from spack.util.path import canonicalize_path - +from spack.package_prefs import PackageTesting #----------------------------------------------------------------------------- # Initialize various data structures & objects at the core of Spack. @@ -158,7 +158,8 @@ build_jobs = _config.get('build_jobs', multiprocessing.cpu_count()) -package_testing = spack.package_prefs.PackageTesting() +# Needed for test dependencies +package_testing = PackageTesting() #----------------------------------------------------------------------------- diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index f7cee015b6..cc03374769 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -62,15 +62,15 @@ import llnl.util.tty as tty from llnl.util.tty.color import colorize -from llnl.util.filesystem import * +from llnl.util.filesystem import join_path, mkdirp, install, install_tree import spack import spack.store from spack.environment import EnvironmentModifications, validate -from spack.util.environment import * +from spack.util.environment import env_flag, filter_system_paths, get_path from spack.util.executable import Executable from spack.util.module_cmd import load_module, get_path_from_module -from spack.util.log_parse import * +from spack.util.log_parse import parse_log_events, make_log_context # diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index b78d3ed026..90ff8540bd 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -27,8 +27,7 @@ import os import os.path import shutil -from os import stat -from stat import * +import stat from subprocess import PIPE from subprocess import check_call @@ -153,7 +152,7 @@ def _do_patch_config_guess(self): if config_guess is not None: try: check_call([config_guess], stdout=PIPE, stderr=PIPE) - mod = stat(my_config_guess).st_mode & 0o777 | S_IWUSR + mod = os.stat(my_config_guess).st_mode & 0o777 | stat.S_IWUSR os.chmod(my_config_guess, mod) shutil.copyfile(config_guess, my_config_guess) return diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index f1e36c2377..3f4f15c44b 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -29,9 +29,9 @@ import sys import llnl.util.tty as tty -from llnl.util.lang import * -from llnl.util.tty.colify import * -from llnl.util.tty.color import * +from llnl.util.lang import attr_setdefault, index_by +from llnl.util.tty.colify import colify +from llnl.util.tty.color import colorize from llnl.util.filesystem import working_dir import spack diff --git a/lib/spack/spack/cmd/build.py b/lib/spack/spack/cmd/build.py index 760aa5e339..70507f79e3 100644 --- a/lib/spack/spack/cmd/build.py +++ b/lib/spack/spack/cmd/build.py @@ -24,7 +24,13 @@ ############################################################################## import spack.cmd.configure as cfg -from spack import * +from spack.build_systems.autotools import AutotoolsPackage +from spack.build_systems.cmake import CMakePackage +from spack.build_systems.qmake import QMakePackage +from spack.build_systems.scons import SConsPackage +from spack.build_systems.waf import WafPackage +from spack.build_systems.python import PythonPackage +from spack.build_systems.perl import PerlPackage description = 'stops at build stage when installing a package, if possible' section = "build" diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index e19eb540a8..bbdd9b0d82 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -31,8 +31,8 @@ import spack.cmd import spack.util.crypto import spack.util.web -from spack.util.naming import * -from spack.version import * +from spack.util.naming import valid_fully_qualified_module_name +from spack.version import ver, Version description = "checksum available versions of a package" section = "packaging" diff --git a/lib/spack/spack/cmd/configure.py b/lib/spack/spack/cmd/configure.py index 795340630e..a85c035f38 100644 --- a/lib/spack/spack/cmd/configure.py +++ b/lib/spack/spack/cmd/configure.py @@ -28,7 +28,12 @@ import spack.cmd import spack.cmd.install as inst -from spack import * +from spack.build_systems.autotools import AutotoolsPackage +from spack.build_systems.cmake import CMakePackage +from spack.build_systems.qmake import QMakePackage +from spack.build_systems.waf import WafPackage +from spack.build_systems.perl import PerlPackage +from spack.build_systems.intel import IntelPackage description = 'stage and configure a package but do not install' section = "build" diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index fd755facac..d38f11f63b 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -35,8 +35,10 @@ from spack.repository import Repo from spack.spec import Spec from spack.util.executable import which -from spack.util.naming import * -from spack.url import * +from spack.util.naming import mod_to_class +from spack.util.naming import simplify_name, valid_fully_qualified_module_name +from spack.url import UndetectableNameError, UndetectableVersionError +from spack.url import parse_name, parse_version description = "create a new package file" section = "packaging" diff --git a/lib/spack/spack/cmd/fetch.py b/lib/spack/spack/cmd/fetch.py index 9df5f81404..7394903bfb 100644 --- a/lib/spack/spack/cmd/fetch.py +++ b/lib/spack/spack/cmd/fetch.py @@ -24,6 +24,8 @@ ############################################################################## import argparse +import llnl.util.tty as tty + import spack import spack.cmd diff --git a/lib/spack/spack/cmd/flake8.py b/lib/spack/spack/cmd/flake8.py index 01e642235d..53eea0b995 100644 --- a/lib/spack/spack/cmd/flake8.py +++ b/lib/spack/spack/cmd/flake8.py @@ -31,10 +31,10 @@ import tempfile import argparse -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, mkdirp import spack -from spack.util.executable import * +from spack.util.executable import which description = "runs source code style checks on Spack. requires flake8" diff --git a/lib/spack/spack/cmd/graph.py b/lib/spack/spack/cmd/graph.py index e17d33f8b4..707e70dd61 100644 --- a/lib/spack/spack/cmd/graph.py +++ b/lib/spack/spack/cmd/graph.py @@ -30,9 +30,8 @@ import spack import spack.cmd import spack.store -from spack.spec import * -from spack.dependency import * -from spack.graph import * +from spack.dependency import all_deptypes, canonical_deptype +from spack.graph import graph_dot, graph_ascii description = "generate graphs of package dependency relationships" section = "basic" diff --git a/lib/spack/spack/cmd/help.py b/lib/spack/spack/cmd/help.py index 0af5b471cd..f459134d24 100644 --- a/lib/spack/spack/cmd/help.py +++ b/lib/spack/spack/cmd/help.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import sys -from llnl.util.tty import colorize +from llnl.util.tty.color import colorize description = "get help on spack and its commands" section = "help" diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index b3b95aa3df..0a54990b14 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -28,7 +28,7 @@ from six.moves import zip_longest -from llnl.util.tty.colify import * +from llnl.util.tty.colify import colify import llnl.util.tty.color as color import spack diff --git a/lib/spack/spack/cmd/pkg.py b/lib/spack/spack/cmd/pkg.py index 8cd6534724..d9d451a3a6 100644 --- a/lib/spack/spack/cmd/pkg.py +++ b/lib/spack/spack/cmd/pkg.py @@ -32,7 +32,7 @@ from llnl.util.filesystem import working_dir import spack -from spack.util.executable import * +from spack.util.executable import which from spack.cmd import spack_is_git_repo description = "query packages associated with particular git revisions" diff --git a/lib/spack/spack/cmd/repo.py b/lib/spack/spack/cmd/repo.py index ac0ae32c92..b51bab55d8 100644 --- a/lib/spack/spack/cmd/repo.py +++ b/lib/spack/spack/cmd/repo.py @@ -30,7 +30,7 @@ import spack.spec import spack.config -from spack.repository import * +from spack.repository import Repo, create_repo, canonicalize_path, RepoError description = "manage package source repositories" section = "config" diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py index 54970f1ea2..abff6c7840 100644 --- a/lib/spack/spack/cmd/test.py +++ b/lib/spack/spack/cmd/test.py @@ -31,7 +31,7 @@ import pytest from six import StringIO -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir from llnl.util.tty.colify import colify import spack diff --git a/lib/spack/spack/cmd/url.py b/lib/spack/spack/cmd/url.py index e4419a5252..c4fae3dd21 100644 --- a/lib/spack/spack/cmd/url.py +++ b/lib/spack/spack/cmd/url.py @@ -29,7 +29,11 @@ import spack from llnl.util import tty -from spack.url import * +from spack.url import parse_version_offset, parse_name_offset +from spack.url import parse_name, parse_version, color_url +from spack.url import substitute_version, substitution_offsets +from spack.url import UndetectableNameError, UndetectableVersionError +from spack.url import UrlParseError from spack.util.web import find_versions_of_archive from spack.util.naming import simplify_name diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 362013436c..a16120aaa5 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -33,7 +33,7 @@ import spack.spec import spack.architecture from spack.util.multiproc import parmap -from spack.util.executable import * +from spack.util.executable import Executable, ProcessError from spack.util.environment import get_path __all__ = ['Compiler', 'get_compiler_version'] diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py index 038d9dfe5a..0af52edec4 100644 --- a/lib/spack/spack/compilers/cce.py +++ b/lib/spack/spack/compilers/cce.py @@ -22,7 +22,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * +from spack.compiler import Compiler, get_compiler_version class Cce(Compiler): diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index b4caad7484..5a88897b68 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -25,14 +25,15 @@ import re import os import sys -import spack -import spack.compiler as cpr -from spack.compiler import * -from spack.util.executable import * -import llnl.util.tty as tty -from spack.version import ver from shutil import copytree, ignore_patterns +import llnl.util.tty as tty + +import spack +from spack.compiler import Compiler, _version_cache +from spack.util.executable import Executable +from spack.version import ver + class Clang(Compiler): # Subclasses use possible names of C compiler @@ -138,7 +139,7 @@ def default_version(cls, comp): Target: x86_64-apple-darwin15.2.0 Thread model: posix """ - if comp not in cpr._version_cache: + if comp not in _version_cache: compiler = Executable(comp) output = compiler('--version', output=str, error=str) @@ -153,9 +154,9 @@ def default_version(cls, comp): if match: ver = match.group(1) - cpr._version_cache[comp] = ver + _version_cache[comp] = ver - return cpr._version_cache[comp] + return _version_cache[comp] def _find_full_path(self, path): basename = os.path.basename(path) diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 70501b447f..c302db5c37 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -23,7 +23,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import llnl.util.tty as tty -from spack.compiler import * + +import spack +from spack.compiler import Compiler, get_compiler_version from spack.version import ver diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 1959c9a661..f53ff2d3f1 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -22,8 +22,9 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * import llnl.util.tty as tty + +from spack.compiler import Compiler, get_compiler_version from spack.version import ver diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py index 0b568da8ed..4551917b20 100644 --- a/lib/spack/spack/compilers/nag.py +++ b/lib/spack/spack/compilers/nag.py @@ -22,7 +22,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * +from spack.compiler import Compiler, get_compiler_version class Nag(Compiler): diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index 9f0c6ce685..2ae3e78a59 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -22,7 +22,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * +from spack.compiler import Compiler, get_compiler_version class Pgi(Compiler): diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index 1a4df820f6..2ee39eb9c8 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -22,8 +22,9 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * import llnl.util.tty as tty + +from spack.compiler import Compiler, get_compiler_version from spack.version import ver diff --git a/lib/spack/spack/compilers/xl_r.py b/lib/spack/spack/compilers/xl_r.py index dd6dc91aae..df4e7dfb54 100644 --- a/lib/spack/spack/compilers/xl_r.py +++ b/lib/spack/spack/compilers/xl_r.py @@ -23,8 +23,9 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack.compiler import * import llnl.util.tty as tty + +from spack.compiler import Compiler, get_compiler_version from spack.version import ver diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index bcbe1b74b8..a510d142d9 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -34,17 +34,17 @@ concretization policies. """ from __future__ import print_function -from six import iteritems -from spack.version import * from itertools import chain from functools_backport import reverse_order +from six import iteritems import spack import spack.spec import spack.compilers import spack.architecture import spack.error -from spack.package_prefs import * +from spack.version import ver, Version, VersionList, VersionRange +from spack.package_prefs import PackagePrefs, spec_externals, is_spec_buildable class DefaultConcretizer(object): @@ -65,7 +65,8 @@ def _valid_virtuals_and_externals(self, spec): if spec.virtual: candidates = spack.repo.providers_for(spec) if not candidates: - raise UnsatisfiableProviderSpecError(candidates[0], spec) + raise spack.spec.UnsatisfiableProviderSpecError( + candidates[0], spec) # Find nearest spec in the DAG (up then down) that has prefs. spec_w_prefs = find_spec( diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 2458fb412d..46e8a5ae2e 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -49,8 +49,8 @@ from yaml.error import MarkedYAMLError, YAMLError import llnl.util.tty as tty -from llnl.util.filesystem import * -from llnl.util.lock import * +from llnl.util.filesystem import join_path, mkdirp +from llnl.util.lock import Lock, WriteTransaction, ReadTransaction import spack.store import spack.repository diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index e294ac15d1..5dc6eaea4e 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -60,7 +60,7 @@ class OpenMpi(Package): import spack.error import spack.spec import spack.url -from spack.dependency import * +from spack.dependency import Dependency, default_deptype, canonical_deptype from spack.fetch_strategy import from_kwargs from spack.patch import Patch from spack.resource import Resource diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 867d73d0a3..dc405f63d8 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -46,17 +46,17 @@ import shutil import copy from functools import wraps -from six import string_types -from six import with_metaclass +from six import string_types, with_metaclass import llnl.util.tty as tty -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, mkdirp, join_path + import spack import spack.error import spack.util.crypto as crypto import spack.util.pattern as pattern -from spack.util.executable import * -from spack.util.string import * +from spack.util.executable import which +from spack.util.string import comma_or from spack.version import Version, ver from spack.util.compression import decompressor_for, extension diff --git a/lib/spack/spack/file_cache.py b/lib/spack/spack/file_cache.py index 1f21531131..57e66e53b9 100644 --- a/lib/spack/spack/file_cache.py +++ b/lib/spack/spack/file_cache.py @@ -25,8 +25,8 @@ import os import shutil -from llnl.util.filesystem import * -from llnl.util.lock import * +from llnl.util.filesystem import mkdirp, join_path +from llnl.util.lock import Lock, ReadTransaction, WriteTransaction from spack.error import SpackError diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py index 994a0297b6..c059dfef65 100644 --- a/lib/spack/spack/graph.py +++ b/lib/spack/spack/graph.py @@ -61,15 +61,16 @@ can take a number of specs as input. """ +import sys -from heapq import * +from heapq import heapify, heappop, heappush from six import iteritems -from llnl.util.lang import * -from llnl.util.tty.color import * +from llnl.util.tty.color import ColorStream + +from spack.spec import Spec +from spack.dependency import all_deptypes, canonical_deptype -from spack.spec import * -from spack.dependency import * __all__ = ['topological_sort', 'graph_ascii', 'AsciiGraph', 'graph_dot'] diff --git a/lib/spack/spack/hooks/case_consistency.py b/lib/spack/spack/hooks/case_consistency.py index b76408e66e..e2d6c68ea1 100644 --- a/lib/spack/spack/hooks/case_consistency.py +++ b/lib/spack/spack/hooks/case_consistency.py @@ -28,11 +28,11 @@ import re import platform -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir import spack from spack.cmd import spack_is_git_repo -from spack.util.executable import * +from spack.util.executable import which, ProcessError def pre_run(): diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 2f542604d5..142d23d42a 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -38,7 +38,6 @@ import llnl.util.tty as tty from llnl.util.tty.log import log_output -from llnl.util.tty.color import * import spack import spack.cmd diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index 06bde4de1f..5b15f26ab2 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -33,14 +33,14 @@ import sys import os import llnl.util.tty as tty -from llnl.util.filesystem import * +from llnl.util.filesystem import mkdirp, join_path import spack import spack.error import spack.url as url import spack.fetch_strategy as fs from spack.spec import Spec -from spack.version import * +from spack.version import VersionList from spack.util.compression import allowed_archive diff --git a/lib/spack/spack/multimethod.py b/lib/spack/spack/multimethod.py index c439141683..67655e0e2f 100644 --- a/lib/spack/spack/multimethod.py +++ b/lib/spack/spack/multimethod.py @@ -45,7 +45,7 @@ """ import functools -from llnl.util.lang import * +from llnl.util.lang import caller_locals, get_calling_module_name import spack.architecture import spack.error diff --git a/lib/spack/spack/operating_systems/cnl.py b/lib/spack/spack/operating_systems/cnl.py index be6a9db60c..1f4ae3c5ab 100644 --- a/lib/spack/spack/operating_systems/cnl.py +++ b/lib/spack/spack/operating_systems/cnl.py @@ -24,10 +24,12 @@ ############################################################################## import re -from spack.architecture import OperatingSystem +import llnl.util.tty as tty + import spack.spec -from spack.util.multiproc import parmap import spack.compilers +from spack.architecture import OperatingSystem +from spack.util.multiproc import parmap from spack.util.module_cmd import get_module_cmd diff --git a/lib/spack/spack/operating_systems/mac_os.py b/lib/spack/spack/operating_systems/mac_os.py index 52a26bc69a..a2f92e7685 100644 --- a/lib/spack/spack/operating_systems/mac_os.py +++ b/lib/spack/spack/operating_systems/mac_os.py @@ -23,8 +23,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import platform as py_platform + from spack.architecture import OperatingSystem -from spack.version import * +from spack.version import Version # FIXME: store versions inside OperatingSystem as a Version instead of string diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 92c4c6ed61..c4b8d53fa5 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -39,6 +39,7 @@ import inspect import os import re +import shutil import sys import textwrap import time @@ -60,15 +61,16 @@ import spack.util.web import spack.multimethod -from llnl.util.filesystem import * -from llnl.util.lang import * +from llnl.util.filesystem import mkdirp, join_path, touch, ancestor +from llnl.util.filesystem import working_dir, install_tree, install +from llnl.util.lang import memoized from llnl.util.link_tree import LinkTree from llnl.util.tty.log import log_output from spack import directory_layout from spack.util.executable import which from spack.stage import Stage, ResourceStage, StageComposite from spack.util.environment import dump_environment -from spack.version import * +from spack.version import Version """Allowed URL schemes for spack packages.""" _ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"] diff --git a/lib/spack/spack/package_prefs.py b/lib/spack/spack/package_prefs.py index 9a3059e748..dfe72c3163 100644 --- a/lib/spack/spack/package_prefs.py +++ b/lib/spack/spack/package_prefs.py @@ -30,7 +30,7 @@ import spack import spack.error from spack.util.path import canonicalize_path -from spack.version import * +from spack.version import VersionList _lesser_spec_types = {'compiler': spack.spec.CompilerSpec, diff --git a/lib/spack/spack/package_test.py b/lib/spack/spack/package_test.py index 32c6318a0d..3f15963461 100644 --- a/lib/spack/spack/package_test.py +++ b/lib/spack/spack/package_test.py @@ -22,8 +22,8 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack import * import os +from spack.util.executable import which, Executable def compile_c_and_execute(source_file, include_flags, link_flags): diff --git a/lib/spack/spack/parse.py b/lib/spack/spack/parse.py index 45b3c2d417..56bf7dd2cb 100644 --- a/lib/spack/spack/parse.py +++ b/lib/spack/spack/parse.py @@ -24,6 +24,7 @@ ############################################################################## import re import shlex +import sys import itertools from six import string_types diff --git a/lib/spack/spack/repository.py b/lib/spack/spack/repository.py index ba33e24069..dedab9f51c 100644 --- a/lib/spack/spack/repository.py +++ b/lib/spack/spack/repository.py @@ -45,14 +45,15 @@ import llnl.util.lang import llnl.util.tty as tty -from llnl.util.filesystem import * +from llnl.util.filesystem import mkdirp, join_path, install import spack import spack.error import spack.spec from spack.provider_index import ProviderIndex from spack.util.path import canonicalize_path -from spack.util.naming import * +from spack.util.naming import NamespaceTrie, valid_module_name +from spack.util.naming import mod_to_class, possible_spack_module_names # # Super-namespace for all packages. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index dfc45850f7..3a4a5953b2 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -102,6 +102,7 @@ import hashlib import itertools import os +import re from operator import attrgetter from six import StringIO @@ -109,8 +110,9 @@ from six import iteritems from llnl.util.filesystem import find_headers, find_libraries, is_exe -from llnl.util.lang import * -from llnl.util.tty.color import * +from llnl.util.lang import key_ordering, HashableMap, ObjectWrapper, dedupe +from llnl.util.lang import check_kwargs +from llnl.util.tty.color import cwrite, colorize, cescape, get_color_when import spack import spack.architecture @@ -121,7 +123,7 @@ import spack.util.spack_json as sjson import spack.util.spack_yaml as syaml -from spack.dependency import * +from spack.dependency import Dependency, all_deptypes, canonical_deptype from spack.util.module_cmd import get_path_from_module, load_module from spack.error import SpecError, UnsatisfiableSpecError from spack.provider_index import ProviderIndex @@ -129,9 +131,13 @@ from spack.util.executable import Executable from spack.util.prefix import Prefix from spack.util.spack_yaml import syaml_dict -from spack.util.string import * -from spack.variant import * -from spack.version import * +from spack.util.string import comma_or +from spack.variant import MultiValuedVariant, AbstractVariant +from spack.variant import BoolValuedVariant, substitute_abstract_variants +from spack.variant import VariantMap, UnknownVariantError +from spack.variant import DuplicateVariantError +from spack.variant import UnsatisfiableVariantSpecError +from spack.version import VersionList, VersionRange, Version, ver from yaml.error import MarkedYAMLError __all__ = [ diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 1d80eb9879..0fc75b1c08 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -35,14 +35,14 @@ import llnl.util.tty as tty import llnl.util.lock -from llnl.util.filesystem import * +from llnl.util.filesystem import mkdirp, join_path, can_access +from llnl.util.filesystem import remove_if_dead_link, remove_linked_tree import spack import spack.config import spack.error import spack.fetch_strategy as fs import spack.util.pattern as pattern -from spack.version import * from spack.util.path import canonicalize_path from spack.util.crypto import prefix_bits, bit_length diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py index 48f35873cb..9685ded121 100644 --- a/lib/spack/spack/test/cc.py +++ b/lib/spack/spack/test/cc.py @@ -31,9 +31,9 @@ import tempfile import shutil -from llnl.util.filesystem import * import spack -from spack.util.executable import * +from llnl.util.filesystem import mkdirp, join_path +from spack.util.executable import Executable # Complicated compiler test command test_command = [ diff --git a/lib/spack/spack/test/cmd/flake8.py b/lib/spack/spack/test/cmd/flake8.py index b6433e95c9..52b8afc859 100644 --- a/lib/spack/spack/test/cmd/flake8.py +++ b/lib/spack/spack/test/cmd/flake8.py @@ -30,9 +30,9 @@ from llnl.util.filesystem import FileFilter import spack -from spack.cmd.flake8 import * +from spack.cmd.flake8 import flake8, setup_parser, changed_files from spack.repository import Repo - +from spack.util.executable import which @pytest.fixture(scope='module') diff --git a/lib/spack/spack/test/cmd/list.py b/lib/spack/spack/test/cmd/list.py index d68f4ddc73..2cb80865c5 100644 --- a/lib/spack/spack/test/cmd/list.py +++ b/lib/spack/spack/test/cmd/list.py @@ -70,4 +70,4 @@ def test_list_with_filters(self, parser, pkg_names): assert pkg_names assert 'cloverleaf3d' in pkg_names - assert 'hdf5' not in pkg_names \ No newline at end of file + assert 'hdf5' not in pkg_names diff --git a/lib/spack/spack/test/cmd/url.py b/lib/spack/spack/test/cmd/url.py index 49b0732288..b3258a45d5 100644 --- a/lib/spack/spack/test/cmd/url.py +++ b/lib/spack/spack/test/cmd/url.py @@ -26,7 +26,8 @@ import pytest from spack.url import UndetectableVersionError from spack.main import SpackCommand -from spack.cmd.url import * +from spack.cmd.url import name_parsed_correctly, version_parsed_correctly +from spack.cmd.url import url_summary url = SpackCommand('url') diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 657d809dba..09aa8b8f86 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -44,9 +44,10 @@ import spack.stage import spack.util.executable import spack.util.pattern -from spack.dependency import * +from spack.dependency import Dependency from spack.package import PackageBase -from spack.fetch_strategy import * +from spack.fetch_strategy import FetchStrategyComposite, URLFetchStrategy +from spack.fetch_strategy import FetchError from spack.spec import Spec from spack.version import Version diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index bc7354a4b4..98cc4a214a 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -27,14 +27,15 @@ both in memory and in its file """ import multiprocessing -import os.path - +import os import pytest + +from llnl.util.tty.colify import colify + import spack import spack.store from spack.test.conftest import MockPackageMultiRepo from spack.util.executable import Executable -from llnl.util.tty.colify import colify def _print_ref_counts(): diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py index 0cfd796e06..efd1a69d84 100644 --- a/lib/spack/spack/test/directory_layout.py +++ b/lib/spack/spack/test/directory_layout.py @@ -26,11 +26,13 @@ This test verifies that the Spack directory layout works properly. """ import os - import pytest + +from llnl.util.filesystem import join_path + import spack -from spack.directory_layout import (YamlDirectoryLayout, - InvalidDirectoryLayoutParametersError) +from spack.directory_layout import YamlDirectoryLayout +from spack.directory_layout import InvalidDirectoryLayoutParametersError from spack.repository import RepoPath from spack.spec import Spec diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py index 1e17dbd6b2..e2edbc2b33 100644 --- a/lib/spack/spack/test/git_fetch.py +++ b/lib/spack/spack/test/git_fetch.py @@ -26,7 +26,7 @@ import pytest import spack -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, join_path, touch from spack.spec import Spec from spack.version import ver from spack.fetch_strategy import GitFetchStrategy diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py index 410d7a4a42..629922cc0b 100644 --- a/lib/spack/spack/test/hg_fetch.py +++ b/lib/spack/spack/test/hg_fetch.py @@ -26,7 +26,7 @@ import pytest import spack -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, join_path, touch from spack.spec import Spec from spack.version import ver from spack.util.executable import which diff --git a/lib/spack/spack/test/llnl/util/lang.py b/lib/spack/spack/test/llnl/util/lang.py index 133ef6cc6c..9e92b0aa21 100644 --- a/lib/spack/spack/test/llnl/util/lang.py +++ b/lib/spack/spack/test/llnl/util/lang.py @@ -25,7 +25,7 @@ import pytest from datetime import datetime, timedelta -from llnl.util.lang import * +from llnl.util.lang import pretty_date, match_predicate def test_pretty_date(): diff --git a/lib/spack/spack/test/llnl/util/link_tree.py b/lib/spack/spack/test/llnl/util/link_tree.py index 64836a86f3..7088c10a77 100644 --- a/lib/spack/spack/test/llnl/util/link_tree.py +++ b/lib/spack/spack/test/llnl/util/link_tree.py @@ -25,7 +25,7 @@ import os import pytest -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, mkdirp, touchp from llnl.util.link_tree import LinkTree from spack.stage import Stage diff --git a/lib/spack/spack/test/llnl/util/lock.py b/lib/spack/spack/test/llnl/util/lock.py index 208777ae51..4466d5999b 100644 --- a/lib/spack/spack/test/llnl/util/lock.py +++ b/lib/spack/spack/test/llnl/util/lock.py @@ -73,8 +73,8 @@ import pytest from llnl.util.filesystem import join_path, touch -from llnl.util.lock import * from spack.util.multiproc import Barrier +from llnl.util.lock import Lock, WriteTransaction, ReadTransaction, LockError # diff --git a/lib/spack/spack/test/make_executable.py b/lib/spack/spack/test/make_executable.py index f47bc1e6a3..cfc7f8ec60 100644 --- a/lib/spack/spack/test/make_executable.py +++ b/lib/spack/spack/test/make_executable.py @@ -32,7 +32,7 @@ import tempfile import unittest -from llnl.util.filesystem import * +from llnl.util.filesystem import join_path from spack.build_environment import MakeExecutable from spack.util.environment import path_put_first diff --git a/lib/spack/spack/test/module_parsing.py b/lib/spack/spack/test/module_parsing.py index 7483b66ebb..df79168d48 100644 --- a/lib/spack/spack/test/module_parsing.py +++ b/lib/spack/spack/test/module_parsing.py @@ -25,7 +25,11 @@ import pytest import subprocess import os -from spack.util.module_cmd import * +from spack.util.module_cmd import get_path_from_module +from spack.util.module_cmd import get_argument_from_module_line +from spack.util.module_cmd import get_module_cmd_from_bash +from spack.util.module_cmd import get_module_cmd, ModuleError + typeset_func = subprocess.Popen('module avail', stdout=subprocess.PIPE, diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py index 4f6dce1ea7..ae4b97cbed 100644 --- a/lib/spack/spack/test/multimethod.py +++ b/lib/spack/spack/test/multimethod.py @@ -25,8 +25,7 @@ """Test for multi_method dispatch.""" import spack import pytest -from spack.multimethod import * -from spack.version import * +from spack.multimethod import NoSuchMethodError def test_no_version_match(builtin_mock): diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index 2fcac53201..4d82f273eb 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -28,7 +28,7 @@ from llnl.util.filesystem import join_path from spack.repository import Repo from spack.util.naming import mod_to_class -from spack.spec import * +from spack.spec import Spec @pytest.mark.usefixtures('config', 'builtin_mock') diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py index de3de6b29c..29a0f0b69a 100644 --- a/lib/spack/spack/test/packaging.py +++ b/lib/spack/spack/test/packaging.py @@ -40,8 +40,11 @@ import spack.cmd.buildcache as buildcache from spack.spec import Spec from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite -from spack.relocate import * from spack.util.executable import ProcessError +from spack.relocate import needs_binary_relocation, get_patchelf +from spack.relocate import substitute_rpath, get_relative_rpaths +from spack.relocate import macho_replace_paths, macho_make_paths_relative +from spack.relocate import modify_macho_object, macho_get_paths @pytest.fixture(scope='function') diff --git a/lib/spack/spack/test/sbang.py b/lib/spack/spack/test/sbang.py index 09fcdab652..c6b3b465e8 100644 --- a/lib/spack/spack/test/sbang.py +++ b/lib/spack/spack/test/sbang.py @@ -32,10 +32,10 @@ import shutil import filecmp -from llnl.util.filesystem import * +from llnl.util.filesystem import mkdirp import spack -from spack.hooks.sbang import * +from spack.hooks.sbang import shebang_too_long, filter_shebangs_in_directory from spack.util.executable import which diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py index a45cb7a961..c85c48504f 100644 --- a/lib/spack/spack/test/spec_dag.py +++ b/lib/spack/spack/test/spec_dag.py @@ -31,7 +31,7 @@ import spack.package from spack.spec import Spec -from spack.dependency import * +from spack.dependency import all_deptypes, Dependency, canonical_deptype from spack.test.conftest import MockPackage, MockPackageMultiRepo diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index e2219e3270..cb6fcc7775 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -25,8 +25,10 @@ import spack.architecture import pytest -from spack.spec import * -from spack.variant import * +from spack.spec import Spec, UnsatisfiableSpecError +from spack.spec import substitute_abstract_variants, parse_anonymous_spec +from spack.variant import InvalidVariantValueError +from spack.variant import MultipleValuesInExclusiveVariantError def target_factory(spec_string, target_concrete): diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index cdae4bfda9..b56246d1fc 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -28,7 +28,12 @@ import spack import spack.spec as sp from spack.parse import Token -from spack.spec import * +from spack.spec import Spec, parse, parse_anonymous_spec +from spack.spec import SpecParseError, RedundantSpecError +from spack.spec import AmbiguousHashError, InvalidHashError, NoSuchHashError +from spack.spec import DuplicateArchitectureError, DuplicateVariantError +from spack.spec import DuplicateDependencyError, DuplicateCompilerSpecError + # Sample output for a complex lexing. complex_lex = [Token(sp.ID, 'mvapich_foo'), diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py index 304edc2828..35b2d786bb 100644 --- a/lib/spack/spack/test/svn_fetch.py +++ b/lib/spack/spack/test/svn_fetch.py @@ -26,7 +26,7 @@ import pytest import spack -from llnl.util.filesystem import * +from llnl.util.filesystem import join_path, touch, working_dir from spack.spec import Spec from spack.version import ver from spack.util.executable import which diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py index 21d871173e..fba087dc99 100644 --- a/lib/spack/spack/test/url_fetch.py +++ b/lib/spack/spack/test/url_fetch.py @@ -25,7 +25,7 @@ import os import pytest -from llnl.util.filesystem import * +from llnl.util.filesystem import working_dir, is_exe import spack from spack.spec import Spec diff --git a/lib/spack/spack/test/url_parse.py b/lib/spack/spack/test/url_parse.py index 3798221cef..4638071126 100644 --- a/lib/spack/spack/test/url_parse.py +++ b/lib/spack/spack/test/url_parse.py @@ -27,9 +27,13 @@ """ import os - import pytest -from spack.url import * + +from spack.url import parse_name_offset, parse_version_offset +from spack.url import parse_name_and_version, substitute_version +from spack.url import strip_name_suffixes, strip_version_suffixes +from spack.url import UndetectableVersionError +from spack.version import Version @pytest.mark.parametrize('url,expected', [ diff --git a/lib/spack/spack/test/variant.py b/lib/spack/spack/test/variant.py index b7117f02ce..9f6a429bda 100644 --- a/lib/spack/spack/test/variant.py +++ b/lib/spack/spack/test/variant.py @@ -26,7 +26,12 @@ import pytest import numbers -from spack.variant import * +from spack.variant import Variant, SingleValuedVariant, VariantMap +from spack.variant import MultiValuedVariant, BoolValuedVariant +from spack.variant import UnsatisfiableVariantSpecError +from spack.variant import InconsistentValidationError +from spack.variant import MultipleValuesInExclusiveVariantError +from spack.variant import InvalidVariantValueError, DuplicateVariantError class TestMultiValuedVariant(object): diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py index 4298cdc2b0..48e88a6bb6 100644 --- a/lib/spack/spack/test/versions.py +++ b/lib/spack/spack/test/versions.py @@ -28,7 +28,7 @@ """ import pytest -from spack.version import * +from spack.version import Version, ver def assert_ver_lt(a, b): diff --git a/lib/spack/spack/test/web.py b/lib/spack/spack/test/web.py index 80a8cc036d..f47efc8dc6 100644 --- a/lib/spack/spack/test/web.py +++ b/lib/spack/spack/test/web.py @@ -27,7 +27,7 @@ import spack from spack.util.web import spider, find_versions_of_archive -from spack.version import * +from spack.version import ver web_data_path = os.path.join(spack.test_path, 'data', 'web') diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py index 7c8024c986..41df8cc3a5 100644 --- a/lib/spack/spack/url.py +++ b/lib/spack/spack/url.py @@ -50,7 +50,7 @@ from six.moves.urllib.parse import urlsplit, urlunsplit import llnl.util.tty as tty -from llnl.util.tty.color import * +from llnl.util.tty.color import colorize import spack.error import spack.util.compression as comp diff --git a/lib/spack/spack/util/spack_yaml.py b/lib/spack/spack/util/spack_yaml.py index f0a0f20856..8497ee6e4a 100644 --- a/lib/spack/spack/util/spack_yaml.py +++ b/lib/spack/spack/util/spack_yaml.py @@ -33,7 +33,7 @@ """ import yaml from yaml import Loader, Dumper -from yaml.nodes import * +from yaml.nodes import MappingNode, SequenceNode, ScalarNode from yaml.constructor import ConstructorError from ordereddict_backport import OrderedDict diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 1676d7126f..3eee7816f6 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -22,10 +22,10 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os + from spack import * -from spack.package_test import * -from spack.util.executable import Executable -import os.path +from spack.package_test import compile_c_and_execute, compare_output_file class Atlas(Package): diff --git a/var/spack/repos/builtin/packages/foam-extend/package.py b/var/spack/repos/builtin/packages/foam-extend/package.py index 550cdc1bff..987ce3548a 100644 --- a/var/spack/repos/builtin/packages/foam-extend/package.py +++ b/var/spack/repos/builtin/packages/foam-extend/package.py @@ -52,14 +52,16 @@ # - Combining +parmgridgen with +float32 probably won't work. # ############################################################################## -from spack import * -from spack.environment import * - import glob import re import shutil import os -from spack.pkg.builtin.openfoam_com import * + +from spack import * +from spack.pkg.builtin.openfoam_com import OpenfoamArch +from spack.pkg.builtin.openfoam_com import add_extra_files +from spack.pkg.builtin.openfoam_com import write_environ +from spack.pkg.builtin.openfoam_com import rewrite_environ_files class FoamExtend(Package): diff --git a/var/spack/repos/builtin/packages/of-adios-write/package.py b/var/spack/repos/builtin/packages/of-adios-write/package.py index cd25fbe654..c615e55807 100644 --- a/var/spack/repos/builtin/packages/of-adios-write/package.py +++ b/var/spack/repos/builtin/packages/of-adios-write/package.py @@ -35,12 +35,12 @@ # OpenFOAM distribution. # ############################################################################## -from spack import * -from spack.environment import * +import os + import llnl.util.tty as tty -import os -from spack.pkg.builtin.openfoam_com import * +from spack import * +from spack.pkg.builtin.openfoam_com import add_extra_files class OfAdiosWrite(Package): diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 4baeecdf83..a64615a78b 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -22,11 +22,12 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -from spack import * -from spack.package_test import * -import spack.architecture import os +from spack import * +from spack.package_test import compare_output_file, compile_c_and_execute +import spack.architecture + class Openblas(MakefilePackage): """OpenBLAS: An optimized BLAS library""" diff --git a/var/spack/repos/builtin/packages/openfoam-com/package.py b/var/spack/repos/builtin/packages/openfoam-com/package.py index 555242f459..e32d7a6c10 100644 --- a/var/spack/repos/builtin/packages/openfoam-com/package.py +++ b/var/spack/repos/builtin/packages/openfoam-com/package.py @@ -58,15 +58,15 @@ # WM_PROJECT_VERSION=plus naming internally. # ############################################################################## -from spack import * -from spack.environment import * -import llnl.util.tty as tty - import glob import re import shutil import os +from spack import * +import llnl.util.tty as tty + + # Not the nice way of doing things, but is a start for refactoring __all__ = [ 'add_extra_files', diff --git a/var/spack/repos/builtin/packages/openfoam-org/package.py b/var/spack/repos/builtin/packages/openfoam-org/package.py index 98e1ba5602..b46df164d5 100644 --- a/var/spack/repos/builtin/packages/openfoam-org/package.py +++ b/var/spack/repos/builtin/packages/openfoam-org/package.py @@ -53,15 +53,19 @@ # - Combining +mgridgen with +int64 or +float32 probably won't work. # ############################################################################## -from spack import * -from spack.environment import * -import llnl.util.tty as tty - import glob import re import shutil import os -from spack.pkg.builtin.openfoam_com import * + +import llnl.util.tty as tty + +from spack import * +from spack.pkg.builtin.openfoam_com import add_extra_files +from spack.pkg.builtin.openfoam_com import write_environ +from spack.pkg.builtin.openfoam_com import rewrite_environ_files +from spack.pkg.builtin.openfoam_com import mplib_content +from spack.pkg.builtin.openfoam_com import OpenfoamArch class OpenfoamOrg(Package): diff --git a/var/spack/repos/builtin/packages/pocl/package.py b/var/spack/repos/builtin/packages/pocl/package.py index 79a7ebff0b..f4facac86b 100644 --- a/var/spack/repos/builtin/packages/pocl/package.py +++ b/var/spack/repos/builtin/packages/pocl/package.py @@ -22,10 +22,10 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os from spack import * -from spack.package_test import * -import os +from spack.package_test import compile_c_and_execute, compare_output_file class Pocl(CMakePackage): diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index e68870b412..15f2974328 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -27,14 +27,13 @@ import platform import re import sys -from contextlib import closing -import spack import llnl.util.tty as tty from llnl.util.lang import match_predicate from llnl.util.filesystem import force_remove + +import spack from spack import * -from spack.util.environment import * from spack.util.prefix import Prefix import spack.util.spack_json as sjson @@ -587,7 +586,7 @@ def write_easy_install_pth(self, exts): if not os.path.isfile(easy_pth): continue - with closing(open(easy_pth)) as f: + with open(easy_pth) as f: for line in f: line = line.rstrip() @@ -610,7 +609,7 @@ def write_easy_install_pth(self, exts): os.remove(main_pth) else: - with closing(open(main_pth, 'w')) as f: + with open(main_pth, 'w') as f: f.write("import sys; sys.__plen = len(sys.path)\n") for path in paths: f.write("{0}\n".format(path)) diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py index 07ad38da98..c993a0f067 100644 --- a/var/spack/repos/builtin/packages/r/package.py +++ b/var/spack/repos/builtin/packages/r/package.py @@ -22,10 +22,8 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## - -from spack import * -from spack.util.environment import * import shutil +from spack import * class R(AutotoolsPackage):