summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.flake85
-rw-r--r--lib/spack/llnl/util/lang.py4
-rw-r--r--lib/spack/llnl/util/multiproc.py6
-rw-r--r--lib/spack/llnl/util/tty/__init__.py6
-rw-r--r--lib/spack/spack/architecture.py5
-rw-r--r--lib/spack/spack/binary_distribution.py6
-rw-r--r--lib/spack/spack/cmd/create.py4
-rw-r--r--lib/spack/spack/compilers/nag.py2
-rw-r--r--lib/spack/spack/compilers/xl_r.py2
-rw-r--r--lib/spack/spack/config.py4
-rw-r--r--lib/spack/spack/directives.py6
-rw-r--r--lib/spack/spack/fetch_strategy.py8
-rw-r--r--lib/spack/spack/mirror.py10
-rw-r--r--lib/spack/spack/operating_systems/mac_os.py2
-rw-r--r--lib/spack/spack/package.py23
-rw-r--r--lib/spack/spack/platforms/bgq.py2
-rw-r--r--lib/spack/spack/platforms/darwin.py2
-rw-r--r--lib/spack/spack/platforms/linux.py2
-rw-r--r--lib/spack/spack/platforms/test.py10
-rw-r--r--lib/spack/spack/stage.py4
-rw-r--r--lib/spack/spack/tengine.py12
-rw-r--r--lib/spack/spack/test/conftest.py9
-rw-r--r--lib/spack/spack/test/flag_handlers.py6
-rw-r--r--lib/spack/spack/test/llnl/util/file_list.py8
-rw-r--r--lib/spack/spack/test/module_parsing.py6
-rw-r--r--lib/spack/spack/test/modules/lmod.py4
-rw-r--r--lib/spack/spack/test/repo.py4
-rw-r--r--lib/spack/spack/test/test_activations.py8
-rw-r--r--lib/spack/spack/util/file_cache.py4
-rw-r--r--lib/spack/spack/util/module_cmd.py6
-rw-r--r--lib/spack/spack/util/package_hash.py12
-rw-r--r--var/spack/repos/builtin/packages/bison/package.py4
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py4
-rw-r--r--var/spack/repos/builtin/packages/oce/package.py6
-rw-r--r--var/spack/repos/builtin/packages/trilinos/package.py4
35 files changed, 106 insertions, 104 deletions
diff --git a/.flake8 b/.flake8
index 49199b35c8..9e7956c919 100644
--- a/.flake8
+++ b/.flake8
@@ -16,6 +16,9 @@
# These are required to get the package.py files to test clean:
# - F999: syntax error in doctest
#
+# Exempt to allow decorator classes to be lowercase, but follow otherwise:
+# - N801: CapWords for class names.
+#
[flake8]
-ignore = E129,E221,E241,E272,E731,F999
+ignore = E129,E221,E241,E272,E731,F999,N801
max-line-length = 79
diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py
index edba6e38e1..4d238217a1 100644
--- a/lib/spack/llnl/util/lang.py
+++ b/lib/spack/llnl/util/lang.py
@@ -282,8 +282,8 @@ class HashableMap(collections.MutableMapping):
def copy(self):
"""Type-agnostic clone method. Preserves subclass type."""
# Construct a new dict of my type
- T = type(self)
- clone = T()
+ self_type = type(self)
+ clone = self_type()
# Copy everything from this dict into it.
for key in self:
diff --git a/lib/spack/llnl/util/multiproc.py b/lib/spack/llnl/util/multiproc.py
index 2bf5d1a200..26902d02ee 100644
--- a/lib/spack/llnl/util/multiproc.py
+++ b/lib/spack/llnl/util/multiproc.py
@@ -39,10 +39,10 @@ def spawn(f):
return fun
-def parmap(f, X):
- pipe = [Pipe() for x in X]
+def parmap(f, elements):
+ pipe = [Pipe() for x in elements]
proc = [Process(target=spawn(f), args=(c, x))
- for x, (p, c) in zip(X, pipe)]
+ for x, (p, c) in zip(elements, pipe)]
[p.start() for p in proc]
[p.join() for p in proc]
return [p.recv() for (p, c) in pipe]
diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py
index d8e5f35379..5bf4e0f8ba 100644
--- a/lib/spack/llnl/util/tty/__init__.py
+++ b/lib/spack/llnl/util/tty/__init__.py
@@ -246,18 +246,18 @@ def hline(label=None, **kwargs):
def terminal_size():
"""Gets the dimensions of the console: (rows, cols)."""
- def ioctl_GWINSZ(fd):
+ def ioctl_gwinsz(fd):
try:
rc = struct.unpack('hh', fcntl.ioctl(
fd, termios.TIOCGWINSZ, '1234'))
except BaseException:
return
return rc
- rc = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
+ rc = ioctl_gwinsz(0) or ioctl_gwinsz(1) or ioctl_gwinsz(2)
if not rc:
try:
fd = os.open(os.ctermid(), os.O_RDONLY)
- rc = ioctl_GWINSZ(fd)
+ rc = ioctl_gwinsz(fd)
os.close(fd)
except BaseException:
pass
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 4ef61d569f..ca0a647121 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -193,14 +193,13 @@ class Platform(object):
return self.operating_sys.get(name, None)
@classmethod
- def setup_platform_environment(self, pkg, env):
+ def setup_platform_environment(cls, pkg, env):
""" Subclass can override this method if it requires any
platform-specific build environment modifications.
"""
- pass
@classmethod
- def detect(self):
+ def detect(cls):
""" Subclass is responsible for implementing this method.
Returns True if the Platform class detects that
it is the current platform
diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py
index b96237ed99..c743be7261 100644
--- a/lib/spack/spack/binary_distribution.py
+++ b/lib/spack/spack/binary_distribution.py
@@ -203,13 +203,13 @@ def tarball_path_name(spec, ext):
def checksum_tarball(file):
# calculate sha256 hash of tar file
- BLOCKSIZE = 65536
+ block_size = 65536
hasher = hashlib.sha256()
with open(file, 'rb') as tfile:
- buf = tfile.read(BLOCKSIZE)
+ buf = tfile.read(block_size)
while len(buf) > 0:
hasher.update(buf)
- buf = tfile.read(BLOCKSIZE)
+ buf = tfile.read(block_size)
return hasher.hexdigest()
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index 650eb81189..eae6e6da3a 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -676,8 +676,8 @@ def create(parser, args):
build_system = get_build_system(args, guesser)
# Create the package template object
- PackageClass = templates[build_system]
- package = PackageClass(name, url, versions)
+ package_class = templates[build_system]
+ package = package_class(name, url, versions)
tty.msg("Created template for {0} package".format(package.name))
# Create a directory for the new package
diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py
index dbe7ae55cf..a279384a74 100644
--- a/lib/spack/spack/compilers/nag.py
+++ b/lib/spack/spack/compilers/nag.py
@@ -72,7 +72,7 @@ class Nag(Compiler):
return '-Wl,-Wl,,-rpath,,'
@classmethod
- def default_version(self, comp):
+ def default_version(cls, comp):
"""The ``-V`` option works for nag compilers.
Output looks like this::
diff --git a/lib/spack/spack/compilers/xl_r.py b/lib/spack/spack/compilers/xl_r.py
index 9aa12a03ce..d926c1d782 100644
--- a/lib/spack/spack/compilers/xl_r.py
+++ b/lib/spack/spack/compilers/xl_r.py
@@ -74,7 +74,7 @@ class XlR(Compiler):
return "-qzerosize"
@classmethod
- def default_version(self, comp):
+ def default_version(cls, comp):
"""The '-qversion' is the standard option fo XL compilers.
Output looks like this::
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index ec37c0a972..2e67f0e1da 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -542,9 +542,9 @@ def _validate_section(data, schema):
"""
import jsonschema
if not hasattr(_validate_section, 'validator'):
- DefaultSettingValidator = _extend_with_default(
+ default_setting_validator = _extend_with_default(
jsonschema.Draft4Validator)
- _validate_section.validator = DefaultSettingValidator
+ _validate_section.validator = default_setting_validator
try:
_validate_section.validator(schema).validate(data)
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index 68678d904d..56490f8452 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -80,7 +80,7 @@ class DirectiveMeta(type):
_directive_names = set()
_directives_to_be_executed = []
- def __new__(mcs, name, bases, attr_dict):
+ def __new__(cls, name, bases, attr_dict):
# Initialize the attribute containing the list of directives
# to be executed. Here we go reversed because we want to execute
# commands:
@@ -109,8 +109,8 @@ class DirectiveMeta(type):
DirectiveMeta._directives_to_be_executed)
DirectiveMeta._directives_to_be_executed = []
- return super(DirectiveMeta, mcs).__new__(
- mcs, name, bases, attr_dict)
+ return super(DirectiveMeta, cls).__new__(
+ cls, name, bases, attr_dict)
def __init__(cls, name, bases, attr_dict):
# The class is being created: if it is a package we must ensure
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index d1c6f607b3..3a08deb754 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -1026,7 +1026,7 @@ class FsCache(object):
def __init__(self, root):
self.root = os.path.abspath(root)
- def store(self, fetcher, relativeDst):
+ def store(self, fetcher, relative_dest):
# skip fetchers that aren't cachable
if not fetcher.cachable:
return
@@ -1035,12 +1035,12 @@ class FsCache(object):
if isinstance(fetcher, CacheURLFetchStrategy):
return
- dst = os.path.join(self.root, relativeDst)
+ dst = os.path.join(self.root, relative_dest)
mkdirp(os.path.dirname(dst))
fetcher.archive(dst)
- def fetcher(self, targetPath, digest, **kwargs):
- path = os.path.join(self.root, targetPath)
+ def fetcher(self, target_path, digest, **kwargs):
+ path = os.path.join(self.root, target_path)
return CacheURLFetchStrategy(path, digest, **kwargs)
def destroy(self):
diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py
index 14e4b482ef..c04a769ba4 100644
--- a/lib/spack/spack/mirror.py
+++ b/lib/spack/spack/mirror.py
@@ -44,7 +44,7 @@ from spack.version import VersionList
from spack.util.compression import allowed_archive
-def mirror_archive_filename(spec, fetcher, resourceId=None):
+def mirror_archive_filename(spec, fetcher, resource_id=None):
"""Get the name of the spec's archive in the mirror."""
if not spec.version.concrete:
raise ValueError("mirror.path requires spec with concrete version.")
@@ -87,18 +87,18 @@ Spack not to expand it with the following syntax:
# Otherwise we'll make a .tar.gz ourselves
ext = 'tar.gz'
- if resourceId:
- filename = "%s-%s" % (resourceId, spec.version) + ".%s" % ext
+ if resource_id:
+ filename = "%s-%s" % (resource_id, spec.version) + ".%s" % ext
else:
filename = "%s-%s" % (spec.package.name, spec.version) + ".%s" % ext
return filename
-def mirror_archive_path(spec, fetcher, resourceId=None):
+def mirror_archive_path(spec, fetcher, resource_id=None):
"""Get the relative path to the spec's archive within a mirror."""
return os.path.join(
- spec.name, mirror_archive_filename(spec, fetcher, resourceId))
+ spec.name, mirror_archive_filename(spec, fetcher, resource_id))
def get_matching_versions(specs, **kwargs):
diff --git a/lib/spack/spack/operating_systems/mac_os.py b/lib/spack/spack/operating_systems/mac_os.py
index 8f283e2fe1..39e3afbda3 100644
--- a/lib/spack/spack/operating_systems/mac_os.py
+++ b/lib/spack/spack/operating_systems/mac_os.py
@@ -29,7 +29,7 @@ from spack.version import Version
# FIXME: store versions inside OperatingSystem as a Version instead of string
-def macOS_version():
+def macos_version():
"""temporary workaround to return a macOS version as a Version object
"""
return Version('.'.join(py_platform.mac_ver()[0].split('.')[:2]))
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index b203551b07..75aed2e899 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -163,7 +163,7 @@ class PackageMeta(
_InstallPhase_run_before = {}
_InstallPhase_run_after = {}
- def __new__(mcs, name, bases, attr_dict):
+ def __new__(cls, name, bases, attr_dict):
if 'phases' in attr_dict:
# Turn the strings in 'phases' into InstallPhase instances
@@ -176,7 +176,7 @@ class PackageMeta(
def _flush_callbacks(check_name):
# Name of the attribute I am going to check it exists
attr_name = PackageMeta.phase_fmt.format(check_name)
- checks = getattr(mcs, attr_name)
+ checks = getattr(cls, attr_name)
if checks:
for phase_name, funcs in checks.items():
try:
@@ -202,12 +202,12 @@ class PackageMeta(
PackageMeta.phase_fmt.format(phase_name)]
getattr(phase, check_name).extend(funcs)
# Clear the attribute for the next class
- setattr(mcs, attr_name, {})
+ setattr(cls, attr_name, {})
_flush_callbacks('run_before')
_flush_callbacks('run_after')
- return super(PackageMeta, mcs).__new__(mcs, name, bases, attr_dict)
+ return super(PackageMeta, cls).__new__(cls, name, bases, attr_dict)
@staticmethod
def register_callback(check_type, *phases):
@@ -1229,7 +1229,7 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
" if the associated spec is not concrete")
raise spack.error.SpackError(err_msg)
- hashContent = list()
+ hash_content = list()
source_id = fs.for_package_version(self, self.version).source_id()
if not source_id:
# TODO? in cases where a digest or source_id isn't available,
@@ -1238,14 +1238,15 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
# referenced by branch name rather than tag or commit ID.
message = 'Missing a source id for {s.name}@{s.version}'
tty.warn(message.format(s=self))
- hashContent.append(''.encode('utf-8'))
+ hash_content.append(''.encode('utf-8'))
else:
- hashContent.append(source_id.encode('utf-8'))
- hashContent.extend(':'.join((p.sha256, str(p.level))).encode('utf-8')
- for p in self.spec.patches)
- hashContent.append(package_hash(self.spec, content))
+ hash_content.append(source_id.encode('utf-8'))
+ hash_content.extend(':'.join((p.sha256, str(p.level))).encode('utf-8')
+ for p in self.spec.patches)
+ hash_content.append(package_hash(self.spec, content))
return base64.b32encode(
- hashlib.sha256(bytes().join(sorted(hashContent))).digest()).lower()
+ hashlib.sha256(bytes().join(
+ sorted(hash_content))).digest()).lower()
@property
def namespace(self):
diff --git a/lib/spack/spack/platforms/bgq.py b/lib/spack/spack/platforms/bgq.py
index 1c46542018..18004d8880 100644
--- a/lib/spack/spack/platforms/bgq.py
+++ b/lib/spack/spack/platforms/bgq.py
@@ -53,5 +53,5 @@ class Bgq(Platform):
self.add_operating_system(str(back_distro), back_distro)
@classmethod
- def detect(self):
+ def detect(cls):
return os.path.exists('/bgsys')
diff --git a/lib/spack/spack/platforms/darwin.py b/lib/spack/spack/platforms/darwin.py
index 3d9e4df9c5..fba3de7fe9 100644
--- a/lib/spack/spack/platforms/darwin.py
+++ b/lib/spack/spack/platforms/darwin.py
@@ -45,5 +45,5 @@ class Darwin(Platform):
self.add_operating_system(str(mac_os), mac_os)
@classmethod
- def detect(self):
+ def detect(cls):
return 'darwin' in platform.system().lower()
diff --git a/lib/spack/spack/platforms/linux.py b/lib/spack/spack/platforms/linux.py
index cf263bb457..0cf906e355 100644
--- a/lib/spack/spack/platforms/linux.py
+++ b/lib/spack/spack/platforms/linux.py
@@ -49,5 +49,5 @@ class Linux(Platform):
self.add_operating_system(str(linux_dist), linux_dist)
@classmethod
- def detect(self):
+ def detect(cls):
return 'linux' in platform.system().lower()
diff --git a/lib/spack/spack/platforms/test.py b/lib/spack/spack/platforms/test.py
index a1ad34b46f..fa1c86effa 100644
--- a/lib/spack/spack/platforms/test.py
+++ b/lib/spack/spack/platforms/test.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack.architecture import Platform, Target
-from spack.architecture import OperatingSystem as OS
+from spack.architecture import OperatingSystem
class Test(Platform):
@@ -41,9 +41,11 @@ class Test(Platform):
self.add_target(self.default, Target(self.default))
self.add_target(self.front_end, Target(self.front_end))
- self.add_operating_system(self.default_os, OS('debian', 6))
- self.add_operating_system(self.front_os, OS('redhat', 6))
+ self.add_operating_system(
+ self.default_os, OperatingSystem('debian', 6))
+ self.add_operating_system(
+ self.front_os, OperatingSystem('redhat', 6))
@classmethod
- def detect(self):
+ def detect(cls):
return True
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 0111ccd840..82363f31ee 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -432,9 +432,9 @@ class Stage(object):
tty.debug(e)
continue
else:
- errMessage = "All fetchers failed for %s" % self.name
+ err_msg = "All fetchers failed for %s" % self.name
self.fetcher = self.default_fetcher
- raise fs.FetchError(errMessage, None)
+ raise fs.FetchError(err_msg, None)
def check(self):
"""Check the downloaded archive against a checksum digest.
diff --git a/lib/spack/spack/tengine.py b/lib/spack/spack/tengine.py
index 731ce78782..c3ce16ac04 100644
--- a/lib/spack/spack/tengine.py
+++ b/lib/spack/spack/tengine.py
@@ -43,10 +43,10 @@ class ContextMeta(type):
#: by the class that is being defined
_new_context_properties = []
- def __new__(mcs, name, bases, attr_dict):
+ def __new__(cls, name, bases, attr_dict):
# Merge all the context properties that are coming from base classes
# into a list without duplicates.
- context_properties = list(mcs._new_context_properties)
+ context_properties = list(cls._new_context_properties)
for x in bases:
try:
context_properties.extend(x.context_properties)
@@ -55,20 +55,20 @@ class ContextMeta(type):
context_properties = list(llnl.util.lang.dedupe(context_properties))
# Flush the list
- mcs._new_context_properties = []
+ cls._new_context_properties = []
# Attach the list to the class being created
attr_dict['context_properties'] = context_properties
- return super(ContextMeta, mcs).__new__(mcs, name, bases, attr_dict)
+ return super(ContextMeta, cls).__new__(cls, name, bases, attr_dict)
@classmethod
- def context_property(mcs, func):
+ def context_property(cls, func):
"""Decorator that adds a function name to the list of new context
properties, and then returns a property.
"""
name = func.__name__
- mcs._new_context_properties.append(name)
+ cls._new_context_properties.append(name)
return property(func)
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 6649fa6a5e..4f4e01930a 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -44,7 +44,7 @@ import spack.platforms.test
import spack.repo
import spack.stage
import spack.util.executable
-import spack.util.pattern
+from spack.util.pattern import Bunch
from spack.dependency import Dependency
from spack.package import PackageBase
from spack.fetch_strategy import FetchStrategyComposite, URLFetchStrategy
@@ -165,10 +165,10 @@ def mock_fetch_cache(monkeypatch):
and raises on fetch.
"""
class MockCache(object):
- def store(self, copyCmd, relativeDst):
+ def store(self, copy_cmd, relative_dest):
pass
- def fetcher(self, targetPath, digest, **kwargs):
+ def fetcher(self, target_path, digest, **kwargs):
return MockCacheFetcher()
class MockCacheFetcher(object):
@@ -508,7 +508,6 @@ def mock_git_repository(tmpdir_factory):
r1 = rev_hash(branch)
r1_file = branch_file
- Bunch = spack.util.pattern.Bunch
checks = {
'master': Bunch(
revision='master', file=r0_file, args={'git': str(repodir)}
@@ -561,7 +560,6 @@ def mock_hg_repository(tmpdir_factory):
hg('commit', '-m' 'revision 1', '-u', 'test')
r1 = get_rev()
- Bunch = spack.util.pattern.Bunch
checks = {
'default': Bunch(
revision=r1, file=r1_file, args={'hg': str(repodir)}
@@ -618,7 +616,6 @@ def mock_svn_repository(tmpdir_factory):
r0 = '1'
r1 = '2'
- Bunch = spack.util.pattern.Bunch
checks = {
'default': Bunch(
revision=r1, file=r1_file, args={'svn': url}),
diff --git a/lib/spack/spack/test/flag_handlers.py b/lib/spack/spack/test/flag_handlers.py
index cd6955646d..a81e00ca89 100644
--- a/lib/spack/spack/test/flag_handlers.py
+++ b/lib/spack/spack/test/flag_handlers.py
@@ -37,7 +37,7 @@ def temp_env():
os.environ = old_env
-def add_O3_to_build_system_cflags(pkg, name, flags):
+def add_o3_to_build_system_cflags(pkg, name, flags):
build_system_flags = []
if name == 'cflags':
build_system_flags.append('-O3')
@@ -137,7 +137,7 @@ class TestFlagHandlers(object):
s = spack.spec.Spec('libelf cppflags=-g')
s.concretize()
pkg = spack.repo.get(s)
- pkg.flag_handler = add_O3_to_build_system_cflags
+ pkg.flag_handler = add_o3_to_build_system_cflags
spack.build_environment.setup_package(pkg, False)
assert '-g' in os.environ['SPACK_CPPFLAGS']
@@ -149,7 +149,7 @@ class TestFlagHandlers(object):
s = spack.spec.Spec('callpath cppflags=-g')
s.concretize()
pkg = spack.repo.get(s)
- pkg.flag_handler = add_O3_to_build_system_cflags
+ pkg.flag_handler = add_o3_to_build_system_cflags
spack.build_environment.setup_package(pkg, False)
assert '-g' in os.environ['SPACK_CPPFLAGS']
diff --git a/lib/spack/spack/test/llnl/util/file_list.py b/lib/spack/spack/test/llnl/util/file_list.py
index 5671661435..6499befd3c 100644
--- a/lib/spack/spack/test/llnl/util/file_list.py
+++ b/lib/spack/spack/test/llnl/util/file_list.py
@@ -263,7 +263,7 @@ def test_searching_order(search_fn, search_list, root, kwargs):
# Now reverse the result and start discarding things
# as soon as you have matches. In the end the list should
# be emptied.
- L = list(reversed(result))
+ rlist = list(reversed(result))
# At this point make sure the search list is a sequence
if isinstance(search_list, six.string_types):
@@ -272,14 +272,14 @@ def test_searching_order(search_fn, search_list, root, kwargs):
# Discard entries in the order they appear in search list
for x in search_list:
try:
- while fnmatch.fnmatch(L[-1], x) or x in L[-1]:
- L.pop()
+ while fnmatch.fnmatch(rlist[-1], x) or x in rlist[-1]:
+ rlist.pop()
except IndexError:
# List is empty
pass
# List should be empty here
- assert len(L) == 0
+ assert len(rlist) == 0
@pytest.mark.parametrize('root,search_list,kwargs,expected', [
diff --git a/lib/spack/spack/test/module_parsing.py b/lib/spack/spack/test/module_parsing.py
index 978de51559..59ea6402d1 100644
--- a/lib/spack/spack/test/module_parsing.py
+++ b/lib/spack/spack/test/module_parsing.py
@@ -42,13 +42,13 @@ MODULE_NOT_DEFINED = b'not found' in typeset
@pytest.fixture
def save_env():
- old_PATH = os.environ.get('PATH', None)
+ old_path = os.environ.get('PATH', None)
old_bash_func = os.environ.get('BASH_FUNC_module()', None)
yield
- if old_PATH:
- os.environ['PATH'] = old_PATH
+ if old_path:
+ os.environ['PATH'] = old_path
if old_bash_func:
os.environ['BASH_FUNC_module()'] = old_bash_func
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 7371a9a0d7..82a31b03a3 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -171,11 +171,11 @@ class TestLmod(object):
path = module.layout.filename
mpi_spec = spec['mpi']
- mpiElement = "{0}/{1}-{2}/".format(
+ mpi_element = "{0}/{1}-{2}/".format(
mpi_spec.name, mpi_spec.version, mpi_spec.dag_hash(length=7)
)
- assert mpiElement in path
+ assert mpi_element in path
mpileaks_spec = spec
mpileaks_element = "{0}/{1}.lua".format(
diff --git a/lib/spack/spack/test/repo.py b/lib/spack/spack/test/repo.py
index 1bac0bb32a..789f0c2dec 100644
--- a/lib/spack/spack/test/repo.py
+++ b/lib/spack/spack/test/repo.py
@@ -42,8 +42,8 @@ def extra_repo(tmpdir_factory):
repo_dir = tmpdir_factory.mktemp(repo_namespace)
repo_dir.ensure('packages', dir=True)
- with open(str(repo_dir.join('repo.yaml')), 'w') as F:
- F.write("""
+ with open(str(repo_dir.join('repo.yaml')), 'w') as f:
+ f.write("""
repo:
namespace: extra_test_repo
""")
diff --git a/lib/spack/spack/test/test_activations.py b/lib/spack/spack/test/test_activations.py
index 04f5580cd9..d9b69446a9 100644
--- a/lib/spack/spack/test/test_activations.py
+++ b/lib/spack/spack/test/test_activations.py
@@ -137,8 +137,8 @@ def python_and_extension_dirs(tmpdir):
create_dir_structure(ext_prefix, ext_dirs)
easy_install_location = 'lib/python2.7/site-packages/easy-install.pth'
- with open(str(ext_prefix.join(easy_install_location)), 'w') as F:
- F.write("""path/to/ext1.egg
+ with open(str(ext_prefix.join(easy_install_location)), 'w') as f:
+ f.write("""path/to/ext1.egg
path/to/setuptools.egg""")
return str(python_prefix), str(ext_prefix)
@@ -204,8 +204,8 @@ def test_python_activation_with_files(tmpdir, python_and_extension_dirs):
assert os.path.exists(os.path.join(python_prefix, 'bin/py-ext-tool'))
easy_install_location = 'lib/python2.7/site-packages/easy-install.pth'
- with open(os.path.join(python_prefix, easy_install_location), 'r') as F:
- easy_install_contents = F.read()
+ with open(os.path.join(python_prefix, easy_install_location), 'r') as f:
+ easy_install_contents = f.read()
assert 'ext1.egg' in easy_install_contents
assert 'setuptools.egg' not in easy_install_contents
diff --git a/lib/spack/spack/util/file_cache.py b/lib/spack/spack/util/file_cache.py
index 56217e3a7c..6dce9b9bdc 100644
--- a/lib/spack/spack/util/file_cache.py
+++ b/lib/spack/spack/util/file_cache.py
@@ -130,7 +130,7 @@ class FileCache(object):
"""
class WriteContextManager(object):
- def __enter__(cm):
+ def __enter__(cm): # noqa
cm.orig_filename = self.cache_path(key)
cm.orig_file = None
if os.path.exists(cm.orig_filename):
@@ -141,7 +141,7 @@ class FileCache(object):
return cm.orig_file, cm.tmp_file
- def __exit__(cm, type, value, traceback):
+ def __exit__(cm, type, value, traceback): # noqa
if cm.orig_file:
cm.orig_file.close()
cm.tmp_file.close()
diff --git a/lib/spack/spack/util/module_cmd.py b/lib/spack/spack/util/module_cmd.py
index 66a553f60c..d8a9ce27d6 100644
--- a/lib/spack/spack/util/module_cmd.py
+++ b/lib/spack/spack/util/module_cmd.py
@@ -194,9 +194,9 @@ def get_path_from_module(mod):
# If it lists a -L instruction, use that
for line in text:
- L = line.find('-L/')
- if L >= 0:
- return line[L + 2:line.find('/lib')]
+ lib_paths = line.find('-L/')
+ if lib_paths >= 0:
+ return line[lib_paths + 2:line.find('/lib')]
# If it sets the PATH, use it
for line in text:
diff --git a/lib/spack/spack/util/package_hash.py b/lib/spack/spack/util/package_hash.py
index 21514745e3..904234baf3 100644
--- a/lib/spack/spack/util/package_hash.py
+++ b/lib/spack/spack/util/package_hash.py
@@ -44,13 +44,13 @@ class RemoveDocstrings(ast.NodeTransformer):
self.generic_visit(node)
return node
- def visit_FunctionDef(self, node):
+ def visit_FunctionDef(self, node): # noqa
return self.remove_docstring(node)
- def visit_ClassDef(self, node):
+ def visit_ClassDef(self, node): # noqa
return self.remove_docstring(node)
- def visit_Module(self, node):
+ def visit_Module(self, node): # noqa
return self.remove_docstring(node)
@@ -69,7 +69,7 @@ class RemoveDirectives(ast.NodeTransformer):
node.targets and isinstance(node.targets[0], ast.Name) and
node.targets[0].id in spack.package.Package.metadata_attrs)
- def visit_ClassDef(self, node):
+ def visit_ClassDef(self, node): # noqa
if node.name == spack.util.naming.mod_to_class(self.spec.name):
node.body = [
c for c in node.body
@@ -83,7 +83,7 @@ class TagMultiMethods(ast.NodeVisitor):
self.spec = spec
self.methods = {}
- def visit_FunctionDef(self, node):
+ def visit_FunctionDef(self, node): # noqa
nodes = self.methods.setdefault(node.name, [])
if node.decorator_list:
dec = node.decorator_list[0]
@@ -112,7 +112,7 @@ class ResolveMultiMethods(ast.NodeTransformer):
result = n
return result
- def visit_FunctionDef(self, node):
+ def visit_FunctionDef(self, node): # noqa
if self.resolve(node) is node:
node.decorator_list = []
return node
diff --git a/var/spack/repos/builtin/packages/bison/package.py b/var/spack/repos/builtin/packages/bison/package.py
index ac920b96aa..8a2d4a111b 100644
--- a/var/spack/repos/builtin/packages/bison/package.py
+++ b/var/spack/repos/builtin/packages/bison/package.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-from spack.operating_systems.mac_os import macOS_version
+from spack.operating_systems.mac_os import macos_version
import sys
@@ -42,7 +42,7 @@ class Bison(AutotoolsPackage):
patch('pgi.patch', when='@3.0.4')
- if sys.platform == 'darwin' and macOS_version() >= Version('10.13'):
+ if sys.platform == 'darwin' and macos_version() >= Version('10.13'):
patch('secure_snprintf.patch', level=0, when='@3.0.4')
build_directory = 'spack-build'
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index fb176edcff..13f7e1abf8 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-from spack.operating_systems.mac_os import macOS_version
+from spack.operating_systems.mac_os import macos_version
from llnl.util import tty
import glob
@@ -157,7 +157,7 @@ class Gcc(AutotoolsPackage):
if sys.platform == 'darwin':
# Fix parallel build on APFS filesystem
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797
- if macOS_version() >= Version('10.13'):
+ if macos_version() >= Version('10.13'):
patch('darwin/apfs.patch', when='@5.5.0,6.1:6.4,7.1:7.3')
# from homebrew via macports
# https://trac.macports.org/ticket/56502#no1
diff --git a/var/spack/repos/builtin/packages/oce/package.py b/var/spack/repos/builtin/packages/oce/package.py
index 45758d6924..6b7b3349bd 100644
--- a/var/spack/repos/builtin/packages/oce/package.py
+++ b/var/spack/repos/builtin/packages/oce/package.py
@@ -23,7 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-from spack.operating_systems.mac_os import macOS_version
+from spack.operating_systems.mac_os import macos_version
import platform
@@ -68,7 +68,7 @@ class Oce(Package):
# fix build with Xcode 8 "previous definition of CLOCK_REALTIME"
# reported 27 Sep 2016 https://github.com/tpaviot/oce/issues/643
if (platform.system() == "Darwin") and (
- macOS_version() == Version('10.12')):
+ macos_version() == Version('10.12')):
patch('sierra.patch', when='@0.17.2:0.18.0')
def install(self, spec, prefix):
@@ -99,7 +99,7 @@ class Oce(Package):
])
if platform.system() == 'Darwin' and (
- macOS_version() >= Version('10.12')):
+ macos_version() >= Version('10.12')):
# use @rpath on Sierra due to limit of dynamic loader
options.append('-DCMAKE_MACOSX_RPATH=ON')
else:
diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py
index 7854226079..9cce2f028e 100644
--- a/var/spack/repos/builtin/packages/trilinos/package.py
+++ b/var/spack/repos/builtin/packages/trilinos/package.py
@@ -25,7 +25,7 @@
import os
import sys
from spack import *
-from spack.operating_systems.mac_os import macOS_version
+from spack.operating_systems.mac_os import macos_version
# Trilinos is complicated to build, as an inspiration a couple of links to
# other repositories which build it:
@@ -703,7 +703,7 @@ class Trilinos(CMakePackage):
'-DTrilinos_ENABLE_FEI=OFF'
])
- if sys.platform == 'darwin' and macOS_version() >= Version('10.12'):
+ if sys.platform == 'darwin' and macos_version() >= Version('10.12'):
# use @rpath on Sierra due to limit of dynamic loader
options.append('-DCMAKE_MACOSX_RPATH=ON')
else: