Drop Python 2 super syntax (#38718)

This commit is contained in:
Adam J. Stewart 2023-07-05 09:04:29 -05:00 committed by GitHub
parent 95847a0b37
commit 45838cee0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
117 changed files with 270 additions and 318 deletions

View file

@ -97,9 +97,7 @@ class PatchedPythonDomain(PythonDomain):
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
if "refspecific" in node: if "refspecific" in node:
del node["refspecific"] del node["refspecific"]
return super(PatchedPythonDomain, self).resolve_xref( return super().resolve_xref(env, fromdocname, builder, typ, target, node, contnode)
env, fromdocname, builder, typ, target, node, contnode
)
# #

View file

@ -121,7 +121,7 @@ Since v0.19, Spack supports two ways of writing a package recipe. The most comm
def url_for_version(self, version): def url_for_version(self, version):
if version >= Version("2.1.1"): if version >= Version("2.1.1"):
return super(Openjpeg, self).url_for_version(version) return super().url_for_version(version)
url_fmt = "https://github.com/uclouvain/openjpeg/archive/version.{0}.tar.gz" url_fmt = "https://github.com/uclouvain/openjpeg/archive/version.{0}.tar.gz"
return url_fmt.format(version) return url_fmt.format(version)
@ -155,7 +155,7 @@ builder class explicitly. Using the same example as above, this reads:
def url_for_version(self, version): def url_for_version(self, version):
if version >= Version("2.1.1"): if version >= Version("2.1.1"):
return super(Openjpeg, self).url_for_version(version) return super().url_for_version(version)
url_fmt = "https://github.com/uclouvain/openjpeg/archive/version.{0}.tar.gz" url_fmt = "https://github.com/uclouvain/openjpeg/archive/version.{0}.tar.gz"
return url_fmt.format(version) return url_fmt.format(version)

View file

@ -1892,7 +1892,7 @@ class HeaderList(FileList):
include_regex = re.compile(r"(.*?)(\binclude\b)(.*)") include_regex = re.compile(r"(.*?)(\binclude\b)(.*)")
def __init__(self, files): def __init__(self, files):
super(HeaderList, self).__init__(files) super().__init__(files)
self._macro_definitions = [] self._macro_definitions = []
self._directories = None self._directories = None
@ -1918,7 +1918,7 @@ def _default_directories(self):
"""Default computation of directories based on the list of """Default computation of directories based on the list of
header files. header files.
""" """
dir_list = super(HeaderList, self).directories dir_list = super().directories
values = [] values = []
for d in dir_list: for d in dir_list:
# If the path contains a subdirectory named 'include' then stop # If the path contains a subdirectory named 'include' then stop

View file

@ -766,7 +766,7 @@ def pretty_seconds(seconds):
class RequiredAttributeError(ValueError): class RequiredAttributeError(ValueError):
def __init__(self, message): def __init__(self, message):
super(RequiredAttributeError, self).__init__(message) super().__init__(message)
class ObjectWrapper: class ObjectWrapper:

View file

@ -430,12 +430,12 @@ class MergeConflictError(Exception):
class ConflictingSpecsError(MergeConflictError): class ConflictingSpecsError(MergeConflictError):
def __init__(self, spec_1, spec_2): def __init__(self, spec_1, spec_2):
super(MergeConflictError, self).__init__(spec_1, spec_2) super().__init__(spec_1, spec_2)
class SingleMergeConflictError(MergeConflictError): class SingleMergeConflictError(MergeConflictError):
def __init__(self, path): def __init__(self, path):
super(MergeConflictError, self).__init__("Package merge blocked by file: %s" % path) super().__init__("Package merge blocked by file: %s" % path)
class MergeConflictSummary(MergeConflictError): class MergeConflictSummary(MergeConflictError):
@ -450,4 +450,4 @@ def __init__(self, conflicts):
msg += "\n `{0}` and `{1}` both project to `{2}`".format( msg += "\n `{0}` and `{1}` both project to `{2}`".format(
conflict.src_a, conflict.src_b, conflict.dst conflict.src_a, conflict.src_b, conflict.dst
) )
super(MergeConflictSummary, self).__init__(msg) super().__init__(msg)

View file

@ -770,7 +770,7 @@ class LockDowngradeError(LockError):
def __init__(self, path): def __init__(self, path):
msg = "Cannot downgrade lock from write to read on file: %s" % path msg = "Cannot downgrade lock from write to read on file: %s" % path
super(LockDowngradeError, self).__init__(msg) super().__init__(msg)
class LockLimitError(LockError): class LockLimitError(LockError):
@ -782,7 +782,7 @@ class LockTimeoutError(LockError):
def __init__(self, lock_type, path, time, attempts): def __init__(self, lock_type, path, time, attempts):
fmt = "Timed out waiting for a {} lock after {}.\n Made {} {} on file: {}" fmt = "Timed out waiting for a {} lock after {}.\n Made {} {} on file: {}"
super(LockTimeoutError, self).__init__( super().__init__(
fmt.format( fmt.format(
lock_type, lock_type,
pretty_seconds(time), pretty_seconds(time),
@ -798,7 +798,7 @@ class LockUpgradeError(LockError):
def __init__(self, path): def __init__(self, path):
msg = "Cannot upgrade lock from read to write on file: %s" % path msg = "Cannot upgrade lock from read to write on file: %s" % path
super(LockUpgradeError, self).__init__(msg) super().__init__(msg)
class LockPermissionError(LockError): class LockPermissionError(LockError):
@ -810,7 +810,7 @@ class LockROFileError(LockPermissionError):
def __init__(self, path): def __init__(self, path):
msg = "Can't take write lock on read-only file: %s" % path msg = "Can't take write lock on read-only file: %s" % path
super(LockROFileError, self).__init__(msg) super().__init__(msg)
class CantCreateLockError(LockPermissionError): class CantCreateLockError(LockPermissionError):
@ -819,4 +819,4 @@ class CantCreateLockError(LockPermissionError):
def __init__(self, path): def __init__(self, path):
msg = "cannot create lock '%s': " % path msg = "cannot create lock '%s': " % path
msg += "file does not exist and location is not writable" msg += "file does not exist and location is not writable"
super(LockError, self).__init__(msg) super().__init__(msg)

View file

@ -68,7 +68,7 @@ class ColorParseError(Exception):
"""Raised when a color format fails to parse.""" """Raised when a color format fails to parse."""
def __init__(self, message): def __init__(self, message):
super(ColorParseError, self).__init__(message) super().__init__(message)
# Text styles for ansi codes # Text styles for ansi codes

View file

@ -80,7 +80,7 @@ def __init__(self, errors):
else: else:
err = errors[0] err = errors[0]
self.message = "{0}: {1}".format(err.__class__.__name__, str(err)) self.message = "{0}: {1}".format(err.__class__.__name__, str(err))
super(FetchCacheError, self).__init__(self.message) super().__init__(self.message)
class ListMirrorSpecsError(spack.error.SpackError): class ListMirrorSpecsError(spack.error.SpackError):
@ -517,9 +517,7 @@ class NoOverwriteException(spack.error.SpackError):
"""Raised when a file would be overwritten""" """Raised when a file would be overwritten"""
def __init__(self, file_path): def __init__(self, file_path):
super(NoOverwriteException, self).__init__( super().__init__(f"Refusing to overwrite the following file: {file_path}")
f"Refusing to overwrite the following file: {file_path}"
)
class NoGpgException(spack.error.SpackError): class NoGpgException(spack.error.SpackError):
@ -528,7 +526,7 @@ class NoGpgException(spack.error.SpackError):
""" """
def __init__(self, msg): def __init__(self, msg):
super(NoGpgException, self).__init__(msg) super().__init__(msg)
class NoKeyException(spack.error.SpackError): class NoKeyException(spack.error.SpackError):
@ -537,7 +535,7 @@ class NoKeyException(spack.error.SpackError):
""" """
def __init__(self, msg): def __init__(self, msg):
super(NoKeyException, self).__init__(msg) super().__init__(msg)
class PickKeyException(spack.error.SpackError): class PickKeyException(spack.error.SpackError):
@ -548,7 +546,7 @@ class PickKeyException(spack.error.SpackError):
def __init__(self, keys): def __init__(self, keys):
err_msg = "Multiple keys available for signing\n%s\n" % keys err_msg = "Multiple keys available for signing\n%s\n" % keys
err_msg += "Use spack buildcache create -k <key hash> to pick a key." err_msg += "Use spack buildcache create -k <key hash> to pick a key."
super(PickKeyException, self).__init__(err_msg) super().__init__(err_msg)
class NoVerifyException(spack.error.SpackError): class NoVerifyException(spack.error.SpackError):
@ -565,7 +563,7 @@ class NoChecksumException(spack.error.SpackError):
""" """
def __init__(self, path, size, contents, algorithm, expected, computed): def __init__(self, path, size, contents, algorithm, expected, computed):
super(NoChecksumException, self).__init__( super().__init__(
f"{algorithm} checksum failed for {path}", f"{algorithm} checksum failed for {path}",
f"Expected {expected} but got {computed}. " f"Expected {expected} but got {computed}. "
f"File size = {size} bytes. Contents = {contents!r}", f"File size = {size} bytes. Contents = {contents!r}",
@ -578,7 +576,7 @@ class NewLayoutException(spack.error.SpackError):
""" """
def __init__(self, msg): def __init__(self, msg):
super(NewLayoutException, self).__init__(msg) super().__init__(msg)
class UnsignedPackageException(spack.error.SpackError): class UnsignedPackageException(spack.error.SpackError):

View file

@ -148,7 +148,7 @@ class MakeExecutable(Executable):
def __init__(self, name, jobs, **kwargs): def __init__(self, name, jobs, **kwargs):
supports_jobserver = kwargs.pop("supports_jobserver", True) supports_jobserver = kwargs.pop("supports_jobserver", True)
super(MakeExecutable, self).__init__(name, **kwargs) super().__init__(name, **kwargs)
self.supports_jobserver = supports_jobserver self.supports_jobserver = supports_jobserver
self.jobs = jobs self.jobs = jobs
@ -175,7 +175,7 @@ def __call__(self, *args, **kwargs):
if jobs_env_jobs is not None: if jobs_env_jobs is not None:
kwargs["extra_env"] = {jobs_env: str(jobs_env_jobs)} kwargs["extra_env"] = {jobs_env: str(jobs_env_jobs)}
return super(MakeExecutable, self).__call__(*args, **kwargs) return super().__call__(*args, **kwargs)
def _on_cray(): def _on_cray():
@ -1332,7 +1332,7 @@ class ChildError(InstallError):
build_errors = [("spack.util.executable", "ProcessError")] build_errors = [("spack.util.executable", "ProcessError")]
def __init__(self, msg, module, classname, traceback_string, log_name, log_type, context): def __init__(self, msg, module, classname, traceback_string, log_name, log_type, context):
super(ChildError, self).__init__(msg) super().__init__(msg)
self.module = module self.module = module
self.name = classname self.name = classname
self.traceback = traceback_string self.traceback = traceback_string

View file

@ -312,7 +312,7 @@ def initconfig(self, pkg, spec, prefix):
@property @property
def std_cmake_args(self): def std_cmake_args(self):
args = super(CachedCMakeBuilder, self).std_cmake_args args = super().std_cmake_args
args.extend(["-C", self.cache_path]) args.extend(["-C", self.cache_path])
return args return args

View file

@ -188,7 +188,7 @@ def __init__(self, pkg):
# Attribute containing the package wrapped in dispatcher with a `__getattr__` # Attribute containing the package wrapped in dispatcher with a `__getattr__`
# method that will forward certain calls to the default builder. # method that will forward certain calls to the default builder.
self.pkg_with_dispatcher = _ForwardToBaseBuilder(pkg, root_builder=self) self.pkg_with_dispatcher = _ForwardToBaseBuilder(pkg, root_builder=self)
super(Adapter, self).__init__(pkg) super().__init__(pkg)
# These two methods don't follow the (self, spec, prefix) signature of phases nor # These two methods don't follow the (self, spec, prefix) signature of phases nor
# the (self) signature of methods, so they are added explicitly to avoid using a # the (self) signature of methods, so they are added explicitly to avoid using a
@ -530,9 +530,9 @@ def setup_build_environment(self, env):
modifications to be applied when the package is built. Package authors modifications to be applied when the package is built. Package authors
can call methods on it to alter the build environment. can call methods on it to alter the build environment.
""" """
if not hasattr(super(Builder, self), "setup_build_environment"): if not hasattr(super(), "setup_build_environment"):
return return
super(Builder, self).setup_build_environment(env) super().setup_build_environment(env)
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
"""Sets up the build environment of packages that depend on this one. """Sets up the build environment of packages that depend on this one.
@ -563,9 +563,9 @@ def setup_dependent_build_environment(self, env, dependent_spec):
the dependent's state. Note that *this* package's spec is the dependent's state. Note that *this* package's spec is
available as ``self.spec`` available as ``self.spec``
""" """
if not hasattr(super(Builder, self), "setup_dependent_build_environment"): if not hasattr(super(), "setup_dependent_build_environment"):
return return
super(Builder, self).setup_dependent_build_environment(env, dependent_spec) super().setup_dependent_build_environment(env, dependent_spec)
def __getitem__(self, idx): def __getitem__(self, idx):
key = self.phases[idx] key = self.phases[idx]

View file

@ -545,7 +545,7 @@ class PythonNameError(spack.error.SpackError):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
super(PythonNameError, self).__init__("{0} is not a permissible Python name.".format(name)) super().__init__("{0} is not a permissible Python name.".format(name))
class CommandNameError(spack.error.SpackError): class CommandNameError(spack.error.SpackError):
@ -553,9 +553,7 @@ class CommandNameError(spack.error.SpackError):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
super(CommandNameError, self).__init__( super().__init__("{0} is not a permissible Spack command name.".format(name))
"{0} is not a permissible Spack command name.".format(name)
)
######################################## ########################################

View file

@ -479,7 +479,7 @@ def __init__(
# substituting '_' for ':'. # substituting '_' for ':'.
dest = dest.replace(":", "_") dest = dest.replace(":", "_")
super(ConfigSetAction, self).__init__( super().__init__(
option_strings=option_strings, option_strings=option_strings,
dest=dest, dest=dest,
nargs=0, nargs=0,

View file

@ -120,7 +120,7 @@ def install(self, spec, prefix):
url_line = ' url = "{url}"' url_line = ' url = "{url}"'
def __init__(self, name, url, versions): def __init__(self, name, url, versions):
super(PackageTemplate, self).__init__(name, versions) super().__init__(name, versions)
self.url_def = self.url_line.format(url=url) self.url_def = self.url_line.format(url=url)
@ -198,7 +198,7 @@ def __init__(self, name, url, *args, **kwargs):
# Make it more obvious that we are renaming the package # Make it more obvious that we are renaming the package
tty.msg("Changing package name from {0} to lua-{0}".format(name)) tty.msg("Changing package name from {0} to lua-{0}".format(name))
name = "lua-{0}".format(name) name = "lua-{0}".format(name)
super(LuaPackageTemplate, self).__init__(name, url, *args, **kwargs) super().__init__(name, url, *args, **kwargs)
class MesonPackageTemplate(PackageTemplate): class MesonPackageTemplate(PackageTemplate):
@ -306,7 +306,7 @@ def __init__(self, name, url, *args, **kwargs):
tty.msg("Changing package name from {0} to rkt-{0}".format(name)) tty.msg("Changing package name from {0} to rkt-{0}".format(name))
name = "rkt-{0}".format(name) name = "rkt-{0}".format(name)
self.body_def = self.body_def.format(name[4:]) self.body_def = self.body_def.format(name[4:])
super(RacketPackageTemplate, self).__init__(name, url, *args, **kwargs) super().__init__(name, url, *args, **kwargs)
class PythonPackageTemplate(PackageTemplate): class PythonPackageTemplate(PackageTemplate):
@ -398,7 +398,7 @@ def __init__(self, name, url, *args, **kwargs):
+ self.url_line + self.url_line
) )
super(PythonPackageTemplate, self).__init__(name, url, *args, **kwargs) super().__init__(name, url, *args, **kwargs)
class RPackageTemplate(PackageTemplate): class RPackageTemplate(PackageTemplate):
@ -437,7 +437,7 @@ def __init__(self, name, url, *args, **kwargs):
if bioc: if bioc:
self.url_line = ' url = "{0}"\n' ' bioc = "{1}"'.format(url, r_name) self.url_line = ' url = "{0}"\n' ' bioc = "{1}"'.format(url, r_name)
super(RPackageTemplate, self).__init__(name, url, *args, **kwargs) super().__init__(name, url, *args, **kwargs)
class PerlmakePackageTemplate(PackageTemplate): class PerlmakePackageTemplate(PackageTemplate):
@ -464,7 +464,7 @@ def __init__(self, name, *args, **kwargs):
tty.msg("Changing package name from {0} to perl-{0}".format(name)) tty.msg("Changing package name from {0} to perl-{0}".format(name))
name = "perl-{0}".format(name) name = "perl-{0}".format(name)
super(PerlmakePackageTemplate, self).__init__(name, *args, **kwargs) super().__init__(name, *args, **kwargs)
class PerlbuildPackageTemplate(PerlmakePackageTemplate): class PerlbuildPackageTemplate(PerlmakePackageTemplate):
@ -497,7 +497,7 @@ def __init__(self, name, *args, **kwargs):
tty.msg("Changing package name from {0} to octave-{0}".format(name)) tty.msg("Changing package name from {0} to octave-{0}".format(name))
name = "octave-{0}".format(name) name = "octave-{0}".format(name)
super(OctavePackageTemplate, self).__init__(name, *args, **kwargs) super().__init__(name, *args, **kwargs)
class RubyPackageTemplate(PackageTemplate): class RubyPackageTemplate(PackageTemplate):
@ -525,7 +525,7 @@ def __init__(self, name, *args, **kwargs):
tty.msg("Changing package name from {0} to ruby-{0}".format(name)) tty.msg("Changing package name from {0} to ruby-{0}".format(name))
name = "ruby-{0}".format(name) name = "ruby-{0}".format(name)
super(RubyPackageTemplate, self).__init__(name, *args, **kwargs) super().__init__(name, *args, **kwargs)
class MakefilePackageTemplate(PackageTemplate): class MakefilePackageTemplate(PackageTemplate):
@ -570,7 +570,7 @@ def __init__(self, name, *args, **kwargs):
tty.msg("Changing package name from {0} to py-{0}".format(name)) tty.msg("Changing package name from {0} to py-{0}".format(name))
name = "py-{0}".format(name) name = "py-{0}".format(name)
super(SIPPackageTemplate, self).__init__(name, *args, **kwargs) super().__init__(name, *args, **kwargs)
templates = { templates = {

View file

@ -673,17 +673,17 @@ class CompilerAccessError(spack.error.SpackError):
def __init__(self, compiler, paths): def __init__(self, compiler, paths):
msg = "Compiler '%s' has executables that are missing" % compiler.spec msg = "Compiler '%s' has executables that are missing" % compiler.spec
msg += " or are not executable: %s" % paths msg += " or are not executable: %s" % paths
super(CompilerAccessError, self).__init__(msg) super().__init__(msg)
class InvalidCompilerError(spack.error.SpackError): class InvalidCompilerError(spack.error.SpackError):
def __init__(self): def __init__(self):
super(InvalidCompilerError, self).__init__("Compiler has no executables.") super().__init__("Compiler has no executables.")
class UnsupportedCompilerFlag(spack.error.SpackError): class UnsupportedCompilerFlag(spack.error.SpackError):
def __init__(self, compiler, feature, flag_name, ver_string=None): def __init__(self, compiler, feature, flag_name, ver_string=None):
super(UnsupportedCompilerFlag, self).__init__( super().__init__(
"{0} ({1}) does not support {2} (as compiler.{3}).".format( "{0} ({1}) does not support {2} (as compiler.{3}).".format(
compiler.name, ver_string if ver_string else compiler.version, feature, flag_name compiler.name, ver_string if ver_string else compiler.version, feature, flag_name
), ),

View file

@ -820,7 +820,7 @@ def name_matches(name, name_list):
class InvalidCompilerConfigurationError(spack.error.SpackError): class InvalidCompilerConfigurationError(spack.error.SpackError):
def __init__(self, compiler_spec): def __init__(self, compiler_spec):
super(InvalidCompilerConfigurationError, self).__init__( super().__init__(
'Invalid configuration for [compiler "%s"]: ' % compiler_spec, 'Invalid configuration for [compiler "%s"]: ' % compiler_spec,
"Compiler configuration must contain entries for all compilers: %s" "Compiler configuration must contain entries for all compilers: %s"
% _path_instance_vars, % _path_instance_vars,
@ -829,19 +829,17 @@ def __init__(self, compiler_spec):
class NoCompilersError(spack.error.SpackError): class NoCompilersError(spack.error.SpackError):
def __init__(self): def __init__(self):
super(NoCompilersError, self).__init__("Spack could not find any compilers!") super().__init__("Spack could not find any compilers!")
class UnknownCompilerError(spack.error.SpackError): class UnknownCompilerError(spack.error.SpackError):
def __init__(self, compiler_name): def __init__(self, compiler_name):
super(UnknownCompilerError, self).__init__( super().__init__("Spack doesn't support the requested compiler: {0}".format(compiler_name))
"Spack doesn't support the requested compiler: {0}".format(compiler_name)
)
class NoCompilerForSpecError(spack.error.SpackError): class NoCompilerForSpecError(spack.error.SpackError):
def __init__(self, compiler_spec, target): def __init__(self, compiler_spec, target):
super(NoCompilerForSpecError, self).__init__( super().__init__(
"No compilers for operating system %s satisfy spec %s" % (target, compiler_spec) "No compilers for operating system %s satisfy spec %s" % (target, compiler_spec)
) )
@ -860,11 +858,9 @@ def __init__(self, compiler_spec, arch_spec):
+ " in the following files:\n\t" + " in the following files:\n\t"
+ "\n\t".join(duplicate_msg(x, y) for x, y in duplicate_table) + "\n\t".join(duplicate_msg(x, y) for x, y in duplicate_table)
) )
super(CompilerDuplicateError, self).__init__(msg) super().__init__(msg)
class CompilerSpecInsufficientlySpecificError(spack.error.SpackError): class CompilerSpecInsufficientlySpecificError(spack.error.SpackError):
def __init__(self, compiler_spec): def __init__(self, compiler_spec):
super(CompilerSpecInsufficientlySpecificError, self).__init__( super().__init__("Multiple compilers satisfy spec %s" % compiler_spec)
"Multiple compilers satisfy spec %s" % compiler_spec
)

View file

@ -132,7 +132,7 @@ def setup_custom_environment(self, pkg, env):
the 'DEVELOPER_DIR' environment variables to cause the xcrun and the 'DEVELOPER_DIR' environment variables to cause the xcrun and
related tools to use this Xcode.app. related tools to use this Xcode.app.
""" """
super(AppleClang, self).setup_custom_environment(pkg, env) super().setup_custom_environment(pkg, env)
if not pkg.use_xcode: if not pkg.use_xcode:
# if we do it for all packages, we get into big troubles with MPI: # if we do it for all packages, we get into big troubles with MPI:

View file

@ -12,7 +12,7 @@ class Cce(Compiler):
"""Cray compiler environment compiler.""" """Cray compiler environment compiler."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Cce, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
# For old cray compilers on module based systems we replace # For old cray compilers on module based systems we replace
# ``version_argument`` with the old value. Cannot be a property # ``version_argument`` with the old value. Cannot be a property
# as the new value is used in classmethods for path-based detection # as the new value is used in classmethods for path-based detection

View file

@ -77,7 +77,7 @@ class Msvc(Compiler):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
new_pth = [pth if pth else get_valid_fortran_pth(args[0].version) for pth in args[3]] new_pth = [pth if pth else get_valid_fortran_pth(args[0].version) for pth in args[3]]
args[3][:] = new_pth args[3][:] = new_pth
super(Msvc, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if os.getenv("ONEAPI_ROOT"): if os.getenv("ONEAPI_ROOT"):
# If this found, it sets all the vars # If this found, it sets all the vars
self.setvarsfile = os.path.join(os.getenv("ONEAPI_ROOT"), "setvars.bat") self.setvarsfile = os.path.join(os.getenv("ONEAPI_ROOT"), "setvars.bat")

View file

@ -792,9 +792,7 @@ def __init__(self, arch, available_os_targets):
" operating systems and targets:\n\t" + "\n\t".join(available_os_target_strs) " operating systems and targets:\n\t" + "\n\t".join(available_os_target_strs)
) )
super(NoCompilersForArchError, self).__init__( super().__init__(err_msg, "Run 'spack compiler find' to add compilers.")
err_msg, "Run 'spack compiler find' to add compilers."
)
class UnavailableCompilerVersionError(spack.error.SpackError): class UnavailableCompilerVersionError(spack.error.SpackError):
@ -806,7 +804,7 @@ def __init__(self, compiler_spec, arch=None):
if arch: if arch:
err_msg += " for operating system {0} and target {1}.".format(arch.os, arch.target) err_msg += " for operating system {0} and target {1}.".format(arch.os, arch.target)
super(UnavailableCompilerVersionError, self).__init__( super().__init__(
err_msg, err_msg,
"Run 'spack compiler find' to add compilers or " "Run 'spack compiler find' to add compilers or "
"'spack compilers' to see which compilers are already recognized" "'spack compilers' to see which compilers are already recognized"
@ -819,7 +817,7 @@ class NoValidVersionError(spack.error.SpackError):
particular spec.""" particular spec."""
def __init__(self, spec): def __init__(self, spec):
super(NoValidVersionError, self).__init__( super().__init__(
"There are no valid versions for %s that match '%s'" % (spec.name, spec.versions) "There are no valid versions for %s that match '%s'" % (spec.name, spec.versions)
) )
@ -830,7 +828,7 @@ class InsufficientArchitectureInfoError(spack.error.SpackError):
system""" system"""
def __init__(self, spec, archs): def __init__(self, spec, archs):
super(InsufficientArchitectureInfoError, self).__init__( super().__init__(
"Cannot determine necessary architecture information for '%s': %s" "Cannot determine necessary architecture information for '%s': %s"
% (spec.name, str(archs)) % (spec.name, str(archs))
) )
@ -846,4 +844,4 @@ def __init__(self, spec):
"The spec\n '%s'\n is configured as not buildable, " "The spec\n '%s'\n is configured as not buildable, "
"and no matching external installs were found" "and no matching external installs were found"
) )
super(NoBuildError, self).__init__(msg % spec) super().__init__(msg % spec)

View file

@ -182,7 +182,7 @@ def __init__(self, name, path, schema, yaml_path=None):
config: config:
install_tree: $spack/opt/spack install_tree: $spack/opt/spack
""" """
super(SingleFileScope, self).__init__(name, path) super().__init__(name, path)
self._raw_data = None self._raw_data = None
self.schema = schema self.schema = schema
self.yaml_path = yaml_path or [] self.yaml_path = yaml_path or []
@ -310,7 +310,7 @@ class InternalConfigScope(ConfigScope):
""" """
def __init__(self, name, data=None): def __init__(self, name, data=None):
super(InternalConfigScope, self).__init__(name, None) super().__init__(name, None)
self.sections = syaml.syaml_dict() self.sections = syaml.syaml_dict()
if data: if data:
@ -1495,7 +1495,7 @@ def __init__(self, validation_error, data, filename=None, line=None):
location += ":%d" % line location += ":%d" % line
message = "%s: %s" % (location, validation_error.message) message = "%s: %s" % (location, validation_error.message)
super(ConfigError, self).__init__(message) super().__init__(message)
def _get_mark(self, validation_error, data): def _get_mark(self, validation_error, data):
"""Get the file/line mark fo a validation error from a Spack YAML file.""" """Get the file/line mark fo a validation error from a Spack YAML file."""

View file

@ -18,7 +18,7 @@ class DockerContext(PathContext):
@tengine.context_property @tengine.context_property
def manifest(self): def manifest(self):
manifest_str = super(DockerContext, self).manifest manifest_str = super().manifest
# Docker doesn't support HEREDOC, so we need to resort to # Docker doesn't support HEREDOC, so we need to resort to
# a horrible echo trick to have the manifest in the Dockerfile # a horrible echo trick to have the manifest in the Dockerfile
echoed_lines = [] echoed_lines = []

View file

@ -199,4 +199,4 @@ def read(path, apply_updates):
class ManifestValidationError(spack.error.SpackError): class ManifestValidationError(spack.error.SpackError):
def __init__(self, msg, long_msg=None): def __init__(self, msg, long_msg=None):
super(ManifestValidationError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)

View file

@ -1667,7 +1667,7 @@ def __init__(self, database, expected, found):
f"you need a newer Spack version to read the DB in '{database.root}'. " f"you need a newer Spack version to read the DB in '{database.root}'. "
f"{self.database_version_message}" f"{self.database_version_message}"
) )
super(InvalidDatabaseVersionError, self).__init__(msg) super().__init__(msg)
@property @property
def database_version_message(self): def database_version_message(self):

View file

@ -388,14 +388,14 @@ class DirectoryLayoutError(SpackError):
"""Superclass for directory layout errors.""" """Superclass for directory layout errors."""
def __init__(self, message, long_msg=None): def __init__(self, message, long_msg=None):
super(DirectoryLayoutError, self).__init__(message, long_msg) super().__init__(message, long_msg)
class RemoveFailedError(DirectoryLayoutError): class RemoveFailedError(DirectoryLayoutError):
"""Raised when a DirectoryLayout cannot remove an install prefix.""" """Raised when a DirectoryLayout cannot remove an install prefix."""
def __init__(self, installed_spec, prefix, error): def __init__(self, installed_spec, prefix, error):
super(RemoveFailedError, self).__init__( super().__init__(
"Could not remove prefix %s for %s : %s" % (prefix, installed_spec.short_spec, error) "Could not remove prefix %s for %s : %s" % (prefix, installed_spec.short_spec, error)
) )
self.cause = error self.cause = error
@ -405,7 +405,7 @@ class InconsistentInstallDirectoryError(DirectoryLayoutError):
"""Raised when a package seems to be installed to the wrong place.""" """Raised when a package seems to be installed to the wrong place."""
def __init__(self, message, long_msg=None): def __init__(self, message, long_msg=None):
super(InconsistentInstallDirectoryError, self).__init__(message, long_msg) super().__init__(message, long_msg)
class SpecReadError(DirectoryLayoutError): class SpecReadError(DirectoryLayoutError):
@ -416,7 +416,7 @@ class InvalidDirectoryLayoutParametersError(DirectoryLayoutError):
"""Raised when a invalid directory layout parameters are supplied""" """Raised when a invalid directory layout parameters are supplied"""
def __init__(self, message, long_msg=None): def __init__(self, message, long_msg=None):
super(InvalidDirectoryLayoutParametersError, self).__init__(message, long_msg) super().__init__(message, long_msg)
class InvalidExtensionSpecError(DirectoryLayoutError): class InvalidExtensionSpecError(DirectoryLayoutError):
@ -427,16 +427,14 @@ class ExtensionAlreadyInstalledError(DirectoryLayoutError):
"""Raised when an extension is added to a package that already has it.""" """Raised when an extension is added to a package that already has it."""
def __init__(self, spec, ext_spec): def __init__(self, spec, ext_spec):
super(ExtensionAlreadyInstalledError, self).__init__( super().__init__("%s is already installed in %s" % (ext_spec.short_spec, spec.short_spec))
"%s is already installed in %s" % (ext_spec.short_spec, spec.short_spec)
)
class ExtensionConflictError(DirectoryLayoutError): class ExtensionConflictError(DirectoryLayoutError):
"""Raised when an extension is added to a package that already has it.""" """Raised when an extension is added to a package that already has it."""
def __init__(self, spec, ext_spec, conflict): def __init__(self, spec, ext_spec, conflict):
super(ExtensionConflictError, self).__init__( super().__init__(
"%s cannot be installed in %s because it conflicts with %s" "%s cannot be installed in %s because it conflicts with %s"
% (ext_spec.short_spec, spec.short_spec, conflict.short_spec) % (ext_spec.short_spec, spec.short_spec, conflict.short_spec)
) )

View file

@ -19,7 +19,7 @@ class SpackError(Exception):
""" """
def __init__(self, message, long_message=None): def __init__(self, message, long_message=None):
super(SpackError, self).__init__() super().__init__()
self.message = message self.message = message
self._long_message = long_message self._long_message = long_message
@ -91,14 +91,14 @@ class UnsupportedPlatformError(SpackError):
"""Raised by packages when a platform is not supported""" """Raised by packages when a platform is not supported"""
def __init__(self, message): def __init__(self, message):
super(UnsupportedPlatformError, self).__init__(message) super().__init__(message)
class NoLibrariesError(SpackError): class NoLibrariesError(SpackError):
"""Raised when package libraries are requested but cannot be found""" """Raised when package libraries are requested but cannot be found"""
def __init__(self, message_or_name, prefix=None): def __init__(self, message_or_name, prefix=None):
super(NoLibrariesError, self).__init__( super().__init__(
message_or_name message_or_name
if prefix is None if prefix is None
else "Unable to locate {0} libraries in {1}".format(message_or_name, prefix) else "Unable to locate {0} libraries in {1}".format(message_or_name, prefix)
@ -123,9 +123,7 @@ class UnsatisfiableSpecError(SpecError):
def __init__(self, provided, required, constraint_type): def __init__(self, provided, required, constraint_type):
# This is only the entrypoint for old concretizer errors # This is only the entrypoint for old concretizer errors
super(UnsatisfiableSpecError, self).__init__( super().__init__("%s does not satisfy %s" % (provided, required))
"%s does not satisfy %s" % (provided, required)
)
self.provided = provided self.provided = provided
self.required = required self.required = required

View file

@ -176,7 +176,7 @@ class CommandNotFoundError(spack.error.SpackError):
""" """
def __init__(self, cmd_name): def __init__(self, cmd_name):
super(CommandNotFoundError, self).__init__( super().__init__(
"{0} is not a recognized Spack command or extension command;" "{0} is not a recognized Spack command or extension command;"
" check with `spack commands`.".format(cmd_name) " check with `spack commands`.".format(cmd_name)
) )
@ -188,6 +188,4 @@ class ExtensionNamingError(spack.error.SpackError):
""" """
def __init__(self, path): def __init__(self, path):
super(ExtensionNamingError, self).__init__( super().__init__("{0} does not match the format for a Spack extension path.".format(path))
"{0} does not match the format for a Spack extension path.".format(path)
)

View file

@ -234,9 +234,7 @@ class FetchStrategyComposite(pattern.Composite):
matches = FetchStrategy.matches matches = FetchStrategy.matches
def __init__(self): def __init__(self):
super(FetchStrategyComposite, self).__init__( super().__init__(["fetch", "check", "expand", "reset", "archive", "cachable", "mirror_id"])
["fetch", "check", "expand", "reset", "archive", "cachable", "mirror_id"]
)
def source_id(self): def source_id(self):
component_ids = tuple(i.source_id() for i in self) component_ids = tuple(i.source_id() for i in self)
@ -263,7 +261,7 @@ class URLFetchStrategy(FetchStrategy):
optional_attrs = list(crypto.hashes.keys()) + ["checksum"] optional_attrs = list(crypto.hashes.keys()) + ["checksum"]
def __init__(self, url=None, checksum=None, **kwargs): def __init__(self, url=None, checksum=None, **kwargs):
super(URLFetchStrategy, self).__init__(**kwargs) super().__init__(**kwargs)
# Prefer values in kwargs to the positionals. # Prefer values in kwargs to the positionals.
self.url = kwargs.get("url", url) self.url = kwargs.get("url", url)
@ -580,7 +578,7 @@ class VCSFetchStrategy(FetchStrategy):
""" """
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(VCSFetchStrategy, self).__init__(**kwargs) super().__init__(**kwargs)
# Set a URL based on the type of fetch strategy. # Set a URL based on the type of fetch strategy.
self.url = kwargs.get(self.url_attr, None) self.url = kwargs.get(self.url_attr, None)
@ -652,7 +650,7 @@ def __init__(self, **kwargs):
# call to __init__ # call to __init__
forwarded_args = copy.copy(kwargs) forwarded_args = copy.copy(kwargs)
forwarded_args.pop("name", None) forwarded_args.pop("name", None)
super(GoFetchStrategy, self).__init__(**forwarded_args) super().__init__(**forwarded_args)
self._go = None self._go = None
@ -681,7 +679,7 @@ def fetch(self):
self.go("get", "-v", "-d", self.url, env=env) self.go("get", "-v", "-d", self.url, env=env)
def archive(self, destination): def archive(self, destination):
super(GoFetchStrategy, self).archive(destination, exclude=".git") super().archive(destination, exclude=".git")
@_needs_stage @_needs_stage
def expand(self): def expand(self):
@ -740,7 +738,7 @@ def __init__(self, **kwargs):
# to __init__ # to __init__
forwarded_args = copy.copy(kwargs) forwarded_args = copy.copy(kwargs)
forwarded_args.pop("name", None) forwarded_args.pop("name", None)
super(GitFetchStrategy, self).__init__(**forwarded_args) super().__init__(**forwarded_args)
self._git = None self._git = None
self.submodules = kwargs.get("submodules", False) self.submodules = kwargs.get("submodules", False)
@ -948,7 +946,7 @@ def clone(self, dest=None, commit=None, branch=None, tag=None, bare=False):
git(*args) git(*args)
def archive(self, destination): def archive(self, destination):
super(GitFetchStrategy, self).archive(destination, exclude=".git") super().archive(destination, exclude=".git")
@_needs_stage @_needs_stage
def reset(self): def reset(self):
@ -997,7 +995,7 @@ def __init__(self, **kwargs):
# to __init__ # to __init__
forwarded_args = copy.copy(kwargs) forwarded_args = copy.copy(kwargs)
forwarded_args.pop("name", None) forwarded_args.pop("name", None)
super(CvsFetchStrategy, self).__init__(**forwarded_args) super().__init__(**forwarded_args)
self._cvs = None self._cvs = None
if self.branch is not None: if self.branch is not None:
@ -1077,7 +1075,7 @@ def _remove_untracked_files(self):
os.unlink(path) os.unlink(path)
def archive(self, destination): def archive(self, destination):
super(CvsFetchStrategy, self).archive(destination, exclude="CVS") super().archive(destination, exclude="CVS")
@_needs_stage @_needs_stage
def reset(self): def reset(self):
@ -1113,7 +1111,7 @@ def __init__(self, **kwargs):
# to __init__ # to __init__
forwarded_args = copy.copy(kwargs) forwarded_args = copy.copy(kwargs)
forwarded_args.pop("name", None) forwarded_args.pop("name", None)
super(SvnFetchStrategy, self).__init__(**forwarded_args) super().__init__(**forwarded_args)
self._svn = None self._svn = None
if self.revision is not None: if self.revision is not None:
@ -1172,7 +1170,7 @@ def _remove_untracked_files(self):
shutil.rmtree(path, ignore_errors=True) shutil.rmtree(path, ignore_errors=True)
def archive(self, destination): def archive(self, destination):
super(SvnFetchStrategy, self).archive(destination, exclude=".svn") super().archive(destination, exclude=".svn")
@_needs_stage @_needs_stage
def reset(self): def reset(self):
@ -1216,7 +1214,7 @@ def __init__(self, **kwargs):
# to __init__ # to __init__
forwarded_args = copy.copy(kwargs) forwarded_args = copy.copy(kwargs)
forwarded_args.pop("name", None) forwarded_args.pop("name", None)
super(HgFetchStrategy, self).__init__(**forwarded_args) super().__init__(**forwarded_args)
self._hg = None self._hg = None
@ -1277,7 +1275,7 @@ def fetch(self):
shutil.move(repo_name, self.stage.source_path) shutil.move(repo_name, self.stage.source_path)
def archive(self, destination): def archive(self, destination):
super(HgFetchStrategy, self).archive(destination, exclude=".hg") super().archive(destination, exclude=".hg")
@_needs_stage @_needs_stage
def reset(self): def reset(self):
@ -1306,7 +1304,7 @@ class S3FetchStrategy(URLFetchStrategy):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
try: try:
super(S3FetchStrategy, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
except ValueError: except ValueError:
if not kwargs.get("url"): if not kwargs.get("url"):
raise ValueError("S3FetchStrategy requires a url for fetching.") raise ValueError("S3FetchStrategy requires a url for fetching.")
@ -1353,7 +1351,7 @@ class GCSFetchStrategy(URLFetchStrategy):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
try: try:
super(GCSFetchStrategy, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
except ValueError: except ValueError:
if not kwargs.get("url"): if not kwargs.get("url"):
raise ValueError("GCSFetchStrategy requires a url for fetching.") raise ValueError("GCSFetchStrategy requires a url for fetching.")
@ -1686,7 +1684,7 @@ class FailedDownloadError(web_util.FetchError):
"""Raised when a download fails.""" """Raised when a download fails."""
def __init__(self, url, msg=""): def __init__(self, url, msg=""):
super(FailedDownloadError, self).__init__("Failed to fetch file from URL: %s" % url, msg) super().__init__("Failed to fetch file from URL: %s" % url, msg)
self.url = url self.url = url
@ -1716,7 +1714,7 @@ def __init__(self, pkg=None, version=None, **args):
if version: if version:
msg += "@{version}".format(version=version) msg += "@{version}".format(version=version)
long_msg = "with arguments: {args}".format(args=args) long_msg = "with arguments: {args}".format(args=args)
super(InvalidArgsError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)
class ChecksumError(web_util.FetchError): class ChecksumError(web_util.FetchError):
@ -1727,6 +1725,4 @@ class NoStageError(web_util.FetchError):
"""Raised when fetch operations are called before set_stage().""" """Raised when fetch operations are called before set_stage()."""
def __init__(self, method): def __init__(self, method):
super(NoStageError, self).__init__( super().__init__("Must call FetchStrategy.set_stage() before calling %s" % method.__name__)
"Must call FetchStrategy.set_stage() before calling %s" % method.__name__
)

View file

@ -255,7 +255,7 @@ class YamlFilesystemView(FilesystemView):
""" """
def __init__(self, root, layout, **kwargs): def __init__(self, root, layout, **kwargs):
super(YamlFilesystemView, self).__init__(root, layout, **kwargs) super().__init__(root, layout, **kwargs)
# Super class gets projections from the kwargs # Super class gets projections from the kwargs
# YAML specific to get projections from YAML file # YAML specific to get projections from YAML file
@ -637,7 +637,7 @@ class SimpleFilesystemView(FilesystemView):
were added.""" were added."""
def __init__(self, root, layout, **kwargs): def __init__(self, root, layout, **kwargs):
super(SimpleFilesystemView, self).__init__(root, layout, **kwargs) super().__init__(root, layout, **kwargs)
def _sanity_check_view_projection(self, specs): def _sanity_check_view_projection(self, specs):
"""A very common issue is that we end up with two specs of the same """A very common issue is that we end up with two specs of the same

View file

@ -2505,7 +2505,7 @@ class InstallError(spack.error.SpackError):
""" """
def __init__(self, message, long_msg=None, pkg=None): def __init__(self, message, long_msg=None, pkg=None):
super(InstallError, self).__init__(message, long_msg) super().__init__(message, long_msg)
self.pkg = pkg self.pkg = pkg
@ -2513,9 +2513,7 @@ class BadInstallPhase(InstallError):
"""Raised for an install phase option is not allowed for a package.""" """Raised for an install phase option is not allowed for a package."""
def __init__(self, pkg_name, phase): def __init__(self, pkg_name, phase):
super(BadInstallPhase, self).__init__( super().__init__("'{0}' is not a valid phase for package {1}".format(phase, pkg_name))
"'{0}' is not a valid phase for package {1}".format(phase, pkg_name)
)
class ExternalPackageError(InstallError): class ExternalPackageError(InstallError):

View file

@ -195,7 +195,7 @@ def index_commands():
class SpackHelpFormatter(argparse.RawTextHelpFormatter): class SpackHelpFormatter(argparse.RawTextHelpFormatter):
def _format_actions_usage(self, actions, groups): def _format_actions_usage(self, actions, groups):
"""Formatter with more concise usage strings.""" """Formatter with more concise usage strings."""
usage = super(SpackHelpFormatter, self)._format_actions_usage(actions, groups) usage = super()._format_actions_usage(actions, groups)
# Eliminate any occurrence of two or more consecutive spaces # Eliminate any occurrence of two or more consecutive spaces
usage = re.sub(r"[ ]{2,}", " ", usage) usage = re.sub(r"[ ]{2,}", " ", usage)
@ -210,7 +210,7 @@ def _format_actions_usage(self, actions, groups):
def add_arguments(self, actions): def add_arguments(self, actions):
actions = sorted(actions, key=operator.attrgetter("option_strings")) actions = sorted(actions, key=operator.attrgetter("option_strings"))
super(SpackHelpFormatter, self).add_arguments(actions) super().add_arguments(actions)
class SpackArgumentParser(argparse.ArgumentParser): class SpackArgumentParser(argparse.ArgumentParser):
@ -330,7 +330,7 @@ def add_subparsers(self, **kwargs):
if sys.version_info[:2] > (3, 6): if sys.version_info[:2] > (3, 6):
kwargs.setdefault("required", True) kwargs.setdefault("required", True)
sp = super(SpackArgumentParser, self).add_subparsers(**kwargs) sp = super().add_subparsers(**kwargs)
# This monkey patching is needed for Python 3.6, which supports # This monkey patching is needed for Python 3.6, which supports
# having a required subparser but don't expose the API used above # having a required subparser but don't expose the API used above
if sys.version_info[:2] == (3, 6): if sys.version_info[:2] == (3, 6):
@ -380,7 +380,7 @@ def format_help(self, level="short"):
return self.format_help_sections(level) return self.format_help_sections(level)
else: else:
# in subparsers, self.prog is, e.g., 'spack install' # in subparsers, self.prog is, e.g., 'spack install'
return super(SpackArgumentParser, self).format_help() return super().format_help()
def _check_value(self, action, value): def _check_value(self, action, value):
# converted value must be one of the choices (if specified) # converted value must be one of the choices (if specified)

View file

@ -693,4 +693,4 @@ class MirrorError(spack.error.SpackError):
"""Superclass of all mirror-creation related errors.""" """Superclass of all mirror-creation related errors."""
def __init__(self, msg, long_msg=None): def __init__(self, msg, long_msg=None):
super(MirrorError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)

View file

@ -275,14 +275,14 @@ class MultiMethodError(spack.error.SpackError):
"""Superclass for multimethod dispatch errors""" """Superclass for multimethod dispatch errors"""
def __init__(self, message): def __init__(self, message):
super(MultiMethodError, self).__init__(message) super().__init__(message)
class NoSuchMethodError(spack.error.SpackError): class NoSuchMethodError(spack.error.SpackError):
"""Raised when we can't find a version of a multi-method.""" """Raised when we can't find a version of a multi-method."""
def __init__(self, cls, method_name, spec, possible_specs): def __init__(self, cls, method_name, spec, possible_specs):
super(NoSuchMethodError, self).__init__( super().__init__(
"Package %s does not support %s called with %s. Options are: %s" "Package %s does not support %s called with %s. Options are: %s"
% (cls.__name__, method_name, spec, ", ".join(str(s) for s in possible_specs)) % (cls.__name__, method_name, spec, ", ".join(str(s) for s in possible_specs))
) )

View file

@ -86,9 +86,9 @@ def __init__(self):
# distro.linux_distribution, while still calling __init__ # distro.linux_distribution, while still calling __init__
# methods further up the MRO, we skip LinuxDistro in the MRO and # methods further up the MRO, we skip LinuxDistro in the MRO and
# call the OperatingSystem superclass __init__ method # call the OperatingSystem superclass __init__ method
super(LinuxDistro, self).__init__(name, version) super().__init__(name, version)
else: else:
super(CrayBackend, self).__init__() super().__init__()
self.modulecmd = module self.modulecmd = module
def __str__(self): def __str__(self):

View file

@ -67,4 +67,4 @@ def __init__(self):
else: else:
version = version[0] version = version[0]
super(LinuxDistro, self).__init__(distname, version) super().__init__(distname, version)

View file

@ -152,7 +152,7 @@ def __init__(self):
mac_ver = str(version.up_to(part)) mac_ver = str(version.up_to(part))
name = mac_releases.get(mac_ver, "macos") name = mac_releases.get(mac_ver, "macos")
super(MacOs, self).__init__(name, mac_ver) super().__init__(name, mac_ver)
def __str__(self): def __str__(self):
return self.name return self.name

View file

@ -72,7 +72,7 @@ def __init__(self):
plat_ver = windows_version() plat_ver = windows_version()
if plat_ver < Version("10"): if plat_ver < Version("10"):
raise SpackError("Spack is not supported on Windows versions older than 10") raise SpackError("Spack is not supported on Windows versions older than 10")
super(WindowsOs, self).__init__("windows{}".format(plat_ver), plat_ver) super().__init__("windows{}".format(plat_ver), plat_ver)
def __str__(self): def __str__(self):
return self.name return self.name

View file

@ -668,7 +668,7 @@ def __init__(self, spec):
pkg_cls = spack.repo.path.get_pkg_class(self.extendee_spec.name) pkg_cls = spack.repo.path.get_pkg_class(self.extendee_spec.name)
pkg_cls(self.extendee_spec)._check_extendable() pkg_cls(self.extendee_spec)._check_extendable()
super(PackageBase, self).__init__() super().__init__()
@classmethod @classmethod
def possible_dependencies( def possible_dependencies(
@ -2511,7 +2511,7 @@ class PackageStillNeededError(InstallError):
"""Raised when package is still needed by another on uninstall.""" """Raised when package is still needed by another on uninstall."""
def __init__(self, spec, dependents): def __init__(self, spec, dependents):
super(PackageStillNeededError, self).__init__("Cannot uninstall %s" % spec) super().__init__("Cannot uninstall %s" % spec)
self.spec = spec self.spec = spec
self.dependents = dependents self.dependents = dependents
@ -2520,14 +2520,14 @@ class PackageError(spack.error.SpackError):
"""Raised when something is wrong with a package definition.""" """Raised when something is wrong with a package definition."""
def __init__(self, message, long_msg=None): def __init__(self, message, long_msg=None):
super(PackageError, self).__init__(message, long_msg) super().__init__(message, long_msg)
class NoURLError(PackageError): class NoURLError(PackageError):
"""Raised when someone tries to build a URL for a package with no URLs.""" """Raised when someone tries to build a URL for a package with no URLs."""
def __init__(self, cls): def __init__(self, cls):
super(NoURLError, self).__init__("Package %s has no version with a URL." % cls.__name__) super().__init__("Package %s has no version with a URL." % cls.__name__)
class InvalidPackageOpError(PackageError): class InvalidPackageOpError(PackageError):
@ -2542,13 +2542,11 @@ class ActivationError(ExtensionError):
"""Raised when there are problems activating an extension.""" """Raised when there are problems activating an extension."""
def __init__(self, msg, long_msg=None): def __init__(self, msg, long_msg=None):
super(ActivationError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)
class DependencyConflictError(spack.error.SpackError): class DependencyConflictError(spack.error.SpackError):
"""Raised when the dependencies cannot be flattened as asked for.""" """Raised when the dependencies cannot be flattened as asked for."""
def __init__(self, conflict): def __init__(self, conflict):
super(DependencyConflictError, self).__init__( super().__init__("%s conflicts with another file in the flattened directory." % (conflict))
"%s conflicts with another file in the flattened directory." % (conflict)
)

View file

@ -152,7 +152,7 @@ def __init__(self, pkg, relative_path, level, working_dir, ordering_key=None):
msg += "package %s.%s does not exist." % (pkg.namespace, pkg.name) msg += "package %s.%s does not exist." % (pkg.namespace, pkg.name)
raise ValueError(msg) raise ValueError(msg)
super(FilePatch, self).__init__(pkg, abs_path, level, working_dir) super().__init__(pkg, abs_path, level, working_dir)
self.path = abs_path self.path = abs_path
self._sha256 = None self._sha256 = None
self.ordering_key = ordering_key self.ordering_key = ordering_key
@ -164,9 +164,7 @@ def sha256(self):
return self._sha256 return self._sha256
def to_dict(self): def to_dict(self):
return llnl.util.lang.union_dicts( return llnl.util.lang.union_dicts(super().to_dict(), {"relative_path": self.relative_path})
super(FilePatch, self).to_dict(), {"relative_path": self.relative_path}
)
class UrlPatch(Patch): class UrlPatch(Patch):
@ -181,7 +179,7 @@ class UrlPatch(Patch):
""" """
def __init__(self, pkg, url, level=1, working_dir=".", ordering_key=None, **kwargs): def __init__(self, pkg, url, level=1, working_dir=".", ordering_key=None, **kwargs):
super(UrlPatch, self).__init__(pkg, url, level, working_dir) super().__init__(pkg, url, level, working_dir)
self.url = url self.url = url
self._stage = None self._stage = None
@ -264,7 +262,7 @@ def clean(self):
self.stage.destroy() self.stage.destroy()
def to_dict(self): def to_dict(self):
data = super(UrlPatch, self).to_dict() data = super().to_dict()
data["url"] = self.url data["url"] = self.url
if self.archive_sha256: if self.archive_sha256:
data["archive_sha256"] = self.archive_sha256 data["archive_sha256"] = self.archive_sha256

View file

@ -12,7 +12,7 @@
class NoPlatformError(spack.error.SpackError): class NoPlatformError(spack.error.SpackError):
def __init__(self): def __init__(self):
msg = "Could not determine a platform for this machine" msg = "Could not determine a platform for this machine"
super(NoPlatformError, self).__init__(msg) super().__init__(msg)
@llnl.util.lang.lazy_lexicographic_ordering @llnl.util.lang.lazy_lexicographic_ordering

View file

@ -59,7 +59,7 @@ def __init__(self):
configuration file "targets.yaml" with keys 'front_end', 'back_end' configuration file "targets.yaml" with keys 'front_end', 'back_end'
scanning /etc/bash/bashrc.local for back_end only scanning /etc/bash/bashrc.local for back_end only
""" """
super(Cray, self).__init__("cray") super().__init__("cray")
# Make all craype targets available. # Make all craype targets available.
for target in self._avail_targets(): for target in self._avail_targets():

View file

@ -20,7 +20,7 @@ class Darwin(Platform):
binary_formats = ["macho"] binary_formats = ["macho"]
def __init__(self): def __init__(self):
super(Darwin, self).__init__("darwin") super().__init__("darwin")
for name in archspec.cpu.TARGETS: for name in archspec.cpu.TARGETS:
self.add_target(name, spack.target.Target(name)) self.add_target(name, spack.target.Target(name))

View file

@ -16,7 +16,7 @@ class Linux(Platform):
priority = 90 priority = 90
def __init__(self): def __init__(self):
super(Linux, self).__init__("linux") super().__init__("linux")
for name in archspec.cpu.TARGETS: for name in archspec.cpu.TARGETS:
self.add_target(name, spack.target.Target(name)) self.add_target(name, spack.target.Target(name))

View file

@ -31,7 +31,7 @@ class Test(Platform):
def __init__(self, name=None): def __init__(self, name=None):
name = name or "test" name = name or "test"
super(Test, self).__init__(name) super().__init__(name)
self.add_target(self.default, spack.target.Target(self.default)) self.add_target(self.default, spack.target.Target(self.default))
self.add_target(self.front_end, spack.target.Target(self.front_end)) self.add_target(self.front_end, spack.target.Target(self.front_end))

View file

@ -17,7 +17,7 @@ class Windows(Platform):
priority = 101 priority = 101
def __init__(self): def __init__(self):
super(Windows, self).__init__("windows") super().__init__("windows")
for name in archspec.cpu.TARGETS: for name in archspec.cpu.TARGETS:
self.add_target(name, spack.target.Target(name)) self.add_target(name, spack.target.Target(name))

View file

@ -39,7 +39,7 @@ def __init__(self, file_path, root_path):
file_path (str): path of the binary file_path (str): path of the binary
root_path (str): original Spack's store root string root_path (str): original Spack's store root string
""" """
super(InstallRootStringError, self).__init__( super().__init__(
"\n %s \ncontains string\n %s \n" "\n %s \ncontains string\n %s \n"
"after replacing it in rpaths.\n" "after replacing it in rpaths.\n"
"Package should not be relocated.\n Use -a to override." % (file_path, root_path) "Package should not be relocated.\n Use -a to override." % (file_path, root_path)

View file

@ -267,7 +267,7 @@ def __init__(self, file_path, old_len, new_len):
old_len (str): original length of the file old_len (str): original length of the file
new_len (str): length of the file after substitution new_len (str): length of the file after substitution
""" """
super(BinaryStringReplacementError, self).__init__( super().__init__(
"Doing a binary string replacement in %s failed.\n" "Doing a binary string replacement in %s failed.\n"
"The size of the file changed from %s to %s\n" "The size of the file changed from %s to %s\n"
"when it should have remanined the same." % (file_path, old_len, new_len) "when it should have remanined the same." % (file_path, old_len, new_len)
@ -280,13 +280,13 @@ def __init__(self, msg):
" To fix this, compile with more padding " " To fix this, compile with more padding "
"(config:install_tree:padded_length), or install to a shorter prefix." "(config:install_tree:padded_length), or install to a shorter prefix."
) )
super(BinaryTextReplaceError, self).__init__(msg) super().__init__(msg)
class CannotGrowString(BinaryTextReplaceError): class CannotGrowString(BinaryTextReplaceError):
def __init__(self, old, new): def __init__(self, old, new):
msg = "Cannot replace {!r} with {!r} because the new prefix is longer.".format(old, new) msg = "Cannot replace {!r} with {!r} because the new prefix is longer.".format(old, new)
super(CannotGrowString, self).__init__(msg) super().__init__(msg)
class CannotShrinkCString(BinaryTextReplaceError): class CannotShrinkCString(BinaryTextReplaceError):
@ -298,4 +298,4 @@ def __init__(self, old, new, full_old_string):
msg = "Cannot replace {!r} with {!r} in the C-string {!r}.".format( msg = "Cannot replace {!r} with {!r} in the C-string {!r}.".format(
old, new, full_old_string old, new, full_old_string
) )
super(CannotShrinkCString, self).__init__(msg) super().__init__(msg)

View file

@ -112,9 +112,7 @@ def __init__(self, fullname, repo, package_name):
self.package_name = package_name self.package_name = package_name
self.package_py = repo.filename_for_package_name(package_name) self.package_py = repo.filename_for_package_name(package_name)
self.fullname = fullname self.fullname = fullname
super(RepoLoader, self).__init__( super().__init__(self.fullname, self.package_py, prepend=self._package_prepend)
self.fullname, self.package_py, prepend=self._package_prepend
)
class SpackNamespaceLoader: class SpackNamespaceLoader:
@ -326,7 +324,7 @@ class SpackNamespace(types.ModuleType):
"""Allow lazy loading of modules.""" """Allow lazy loading of modules."""
def __init__(self, namespace): def __init__(self, namespace):
super(SpackNamespace, self).__init__(namespace) super().__init__(namespace)
self.__file__ = "(spack namespace)" self.__file__ = "(spack namespace)"
self.__path__ = [] self.__path__ = []
self.__name__ = namespace self.__name__ = namespace
@ -1500,7 +1498,7 @@ def __init__(self, name, repo=None):
else: else:
long_msg = "You may need to run 'spack clean -m'." long_msg = "You may need to run 'spack clean -m'."
super(UnknownPackageError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)
self.name = name self.name = name
@ -1512,14 +1510,14 @@ def __init__(self, namespace, name=None):
if name == "yaml": if name == "yaml":
long_msg = "Did you mean to specify a filename with './{}.{}'?" long_msg = "Did you mean to specify a filename with './{}.{}'?"
long_msg = long_msg.format(namespace, name) long_msg = long_msg.format(namespace, name)
super(UnknownNamespaceError, self).__init__(msg, long_msg) super().__init__(msg, long_msg)
class FailedConstructorError(RepoError): class FailedConstructorError(RepoError):
"""Raised when a package's class constructor fails.""" """Raised when a package's class constructor fails."""
def __init__(self, name, exc_type, exc_obj, exc_tb): def __init__(self, name, exc_type, exc_obj, exc_tb):
super(FailedConstructorError, self).__init__( super().__init__(
"Class constructor failed for package '%s'." % name, "Class constructor failed for package '%s'." % name,
"\nCaused by:\n" "\nCaused by:\n"
+ ("%s: %s\n" % (exc_type.__name__, exc_obj)) + ("%s: %s\n" % (exc_type.__name__, exc_obj))

View file

@ -126,14 +126,14 @@ class RewireError(spack.error.SpackError):
"""Raised when something goes wrong with rewiring.""" """Raised when something goes wrong with rewiring."""
def __init__(self, message, long_msg=None): def __init__(self, message, long_msg=None):
super(RewireError, self).__init__(message, long_msg) super().__init__(message, long_msg)
class PackageNotInstalledError(RewireError): class PackageNotInstalledError(RewireError):
"""Raised when the build_spec for a splice was not installed.""" """Raised when the build_spec for a splice was not installed."""
def __init__(self, spliced_spec, build_spec, dep): def __init__(self, spliced_spec, build_spec, dep):
super(PackageNotInstalledError, self).__init__( super().__init__(
"""Rewire of {0} """Rewire of {0}
failed due to missing install of build spec {1} failed due to missing install of build spec {1}
for spec {2}""".format( for spec {2}""".format(

View file

@ -30,7 +30,7 @@ def __init__(self, raw):
raw.seekable = lambda: False raw.seekable = lambda: False
raw.closed = False raw.closed = False
raw.flush = lambda: None raw.flush = lambda: None
super(WrapStream, self).__init__(raw) super().__init__(raw)
def detach(self): def detach(self):
self.raw = None self.raw = None

View file

@ -825,7 +825,7 @@ class FlagMap(lang.HashableMap):
__slots__ = ("spec",) __slots__ = ("spec",)
def __init__(self, spec): def __init__(self, spec):
super(FlagMap, self).__init__() super().__init__()
self.spec = spec self.spec = spec
def satisfies(self, other): def satisfies(self, other):
@ -1292,7 +1292,7 @@ class SpecBuildInterface(lang.ObjectWrapper):
libs = ForwardQueryToPackage("libs", default_handler=_libs_default_handler) libs = ForwardQueryToPackage("libs", default_handler=_libs_default_handler)
def __init__(self, spec, name, query_parameters): def __init__(self, spec, name, query_parameters):
super(SpecBuildInterface, self).__init__(spec) super().__init__(spec)
# Adding new attributes goes after super() call since the ObjectWrapper # Adding new attributes goes after super() call since the ObjectWrapper
# resets __dict__ to behave like the passed object # resets __dict__ to behave like the passed object
original_spec = getattr(spec, "wrapped_obj", spec) original_spec = getattr(spec, "wrapped_obj", spec)
@ -5138,7 +5138,7 @@ class LazySpecCache(collections.defaultdict):
""" """
def __init__(self): def __init__(self):
super(LazySpecCache, self).__init__(Spec) super().__init__(Spec)
def __missing__(self, key): def __missing__(self, key):
value = self.default_factory(key) value = self.default_factory(key)
@ -5183,7 +5183,7 @@ class SpecParseError(spack.error.SpecError):
"""Wrapper for ParseError for when we're parsing specs.""" """Wrapper for ParseError for when we're parsing specs."""
def __init__(self, parse_error): def __init__(self, parse_error):
super(SpecParseError, self).__init__(parse_error.message) super().__init__(parse_error.message)
self.string = parse_error.string self.string = parse_error.string
self.pos = parse_error.pos self.pos = parse_error.pos
@ -5220,9 +5220,7 @@ class UnsupportedCompilerError(spack.error.SpecError):
"""Raised when the user asks for a compiler spack doesn't know about.""" """Raised when the user asks for a compiler spack doesn't know about."""
def __init__(self, compiler_name): def __init__(self, compiler_name):
super(UnsupportedCompilerError, self).__init__( super().__init__("The '%s' compiler is not yet supported." % compiler_name)
"The '%s' compiler is not yet supported." % compiler_name
)
class DuplicateArchitectureError(spack.error.SpecError): class DuplicateArchitectureError(spack.error.SpecError):
@ -5240,7 +5238,7 @@ class InvalidDependencyError(spack.error.SpecError):
def __init__(self, pkg, deps): def __init__(self, pkg, deps):
self.invalid_deps = deps self.invalid_deps = deps
super(InvalidDependencyError, self).__init__( super().__init__(
"Package {0} does not depend on {1}".format(pkg, spack.util.string.comma_or(deps)) "Package {0} does not depend on {1}".format(pkg, spack.util.string.comma_or(deps))
) )
@ -5251,9 +5249,7 @@ class NoProviderError(spack.error.SpecError):
""" """
def __init__(self, vpkg): def __init__(self, vpkg):
super(NoProviderError, self).__init__( super().__init__("No providers found for virtual package: '%s'" % vpkg)
"No providers found for virtual package: '%s'" % vpkg
)
self.vpkg = vpkg self.vpkg = vpkg
@ -5264,7 +5260,7 @@ class MultipleProviderError(spack.error.SpecError):
def __init__(self, vpkg, providers): def __init__(self, vpkg, providers):
"""Takes the name of the vpkg""" """Takes the name of the vpkg"""
super(MultipleProviderError, self).__init__( super().__init__(
"Multiple providers found for '%s': %s" % (vpkg, [str(s) for s in providers]) "Multiple providers found for '%s': %s" % (vpkg, [str(s) for s in providers])
) )
self.vpkg = vpkg self.vpkg = vpkg
@ -5275,39 +5271,35 @@ class UnsatisfiableSpecNameError(spack.error.UnsatisfiableSpecError):
"""Raised when two specs aren't even for the same package.""" """Raised when two specs aren't even for the same package."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableSpecNameError, self).__init__(provided, required, "name") super().__init__(provided, required, "name")
class UnsatisfiableVersionSpecError(spack.error.UnsatisfiableSpecError): class UnsatisfiableVersionSpecError(spack.error.UnsatisfiableSpecError):
"""Raised when a spec version conflicts with package constraints.""" """Raised when a spec version conflicts with package constraints."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableVersionSpecError, self).__init__(provided, required, "version") super().__init__(provided, required, "version")
class UnsatisfiableCompilerSpecError(spack.error.UnsatisfiableSpecError): class UnsatisfiableCompilerSpecError(spack.error.UnsatisfiableSpecError):
"""Raised when a spec comiler conflicts with package constraints.""" """Raised when a spec comiler conflicts with package constraints."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableCompilerSpecError, self).__init__(provided, required, "compiler") super().__init__(provided, required, "compiler")
class UnsatisfiableCompilerFlagSpecError(spack.error.UnsatisfiableSpecError): class UnsatisfiableCompilerFlagSpecError(spack.error.UnsatisfiableSpecError):
"""Raised when a spec variant conflicts with package constraints.""" """Raised when a spec variant conflicts with package constraints."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableCompilerFlagSpecError, self).__init__( super().__init__(provided, required, "compiler_flags")
provided, required, "compiler_flags"
)
class UnsatisfiableArchitectureSpecError(spack.error.UnsatisfiableSpecError): class UnsatisfiableArchitectureSpecError(spack.error.UnsatisfiableSpecError):
"""Raised when a spec architecture conflicts with package constraints.""" """Raised when a spec architecture conflicts with package constraints."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableArchitectureSpecError, self).__init__( super().__init__(provided, required, "architecture")
provided, required, "architecture"
)
class UnsatisfiableProviderSpecError(spack.error.UnsatisfiableSpecError): class UnsatisfiableProviderSpecError(spack.error.UnsatisfiableSpecError):
@ -5315,7 +5307,7 @@ class UnsatisfiableProviderSpecError(spack.error.UnsatisfiableSpecError):
a vpkg requirement""" a vpkg requirement"""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableProviderSpecError, self).__init__(provided, required, "provider") super().__init__(provided, required, "provider")
# TODO: get rid of this and be more specific about particular incompatible # TODO: get rid of this and be more specific about particular incompatible
@ -5324,7 +5316,7 @@ class UnsatisfiableDependencySpecError(spack.error.UnsatisfiableSpecError):
"""Raised when some dependency of constrained specs are incompatible""" """Raised when some dependency of constrained specs are incompatible"""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableDependencySpecError, self).__init__(provided, required, "dependency") super().__init__(provided, required, "dependency")
class UnconstrainableDependencySpecError(spack.error.SpecError): class UnconstrainableDependencySpecError(spack.error.SpecError):
@ -5333,7 +5325,7 @@ class UnconstrainableDependencySpecError(spack.error.SpecError):
def __init__(self, spec): def __init__(self, spec):
msg = "Cannot constrain by spec '%s'. Cannot constrain by a" % spec msg = "Cannot constrain by spec '%s'. Cannot constrain by a" % spec
msg += " spec containing anonymous dependencies" msg += " spec containing anonymous dependencies"
super(UnconstrainableDependencySpecError, self).__init__(msg) super().__init__(msg)
class AmbiguousHashError(spack.error.SpecError): class AmbiguousHashError(spack.error.SpecError):
@ -5341,14 +5333,14 @@ def __init__(self, msg, *specs):
spec_fmt = "{namespace}.{name}{@version}{%compiler}{compiler_flags}" spec_fmt = "{namespace}.{name}{@version}{%compiler}{compiler_flags}"
spec_fmt += "{variants}{arch=architecture}{/hash:7}" spec_fmt += "{variants}{arch=architecture}{/hash:7}"
specs_str = "\n " + "\n ".join(spec.format(spec_fmt) for spec in specs) specs_str = "\n " + "\n ".join(spec.format(spec_fmt) for spec in specs)
super(AmbiguousHashError, self).__init__(msg + specs_str) super().__init__(msg + specs_str)
class InvalidHashError(spack.error.SpecError): class InvalidHashError(spack.error.SpecError):
def __init__(self, spec, hash): def __init__(self, spec, hash):
msg = f"No spec with hash {hash} could be found to match {spec}." msg = f"No spec with hash {hash} could be found to match {spec}."
msg += " Either the hash does not exist, or it does not match other spec constraints." msg += " Either the hash does not exist, or it does not match other spec constraints."
super(InvalidHashError, self).__init__(msg) super().__init__(msg)
class SpecFilenameError(spack.error.SpecError): class SpecFilenameError(spack.error.SpecError):
@ -5361,7 +5353,7 @@ class NoSuchSpecFileError(SpecFilenameError):
class RedundantSpecError(spack.error.SpecError): class RedundantSpecError(spack.error.SpecError):
def __init__(self, spec, addition): def __init__(self, spec, addition):
super(RedundantSpecError, self).__init__( super().__init__(
"Attempting to add %s to spec %s which is already concrete." "Attempting to add %s to spec %s which is already concrete."
" This is likely the result of adding to a spec specified by hash." % (addition, spec) " This is likely the result of adding to a spec specified by hash." % (addition, spec)
) )
@ -5377,7 +5369,7 @@ class SpecFormatSigilError(SpecFormatStringError):
def __init__(self, sigil, requirement, used): def __init__(self, sigil, requirement, used):
msg = "The sigil %s may only be used for %s." % (sigil, requirement) msg = "The sigil %s may only be used for %s." % (sigil, requirement)
msg += " It was used with the attribute %s." % used msg += " It was used with the attribute %s." % used
super(SpecFormatSigilError, self).__init__(msg) super().__init__(msg)
class ConflictsInSpecError(spack.error.SpecError, RuntimeError): class ConflictsInSpecError(spack.error.SpecError, RuntimeError):
@ -5402,7 +5394,7 @@ def __init__(self, spec, matches):
else: else:
long_message += match_fmt_custom.format(idx + 1, c, w, msg) long_message += match_fmt_custom.format(idx + 1, c, w, msg)
super(ConflictsInSpecError, self).__init__(message, long_message) super().__init__(message, long_message)
class SpecDependencyNotFoundError(spack.error.SpecError): class SpecDependencyNotFoundError(spack.error.SpecError):

View file

@ -674,16 +674,16 @@ def destroy(self):
class ResourceStage(Stage): class ResourceStage(Stage):
def __init__(self, url_or_fetch_strategy, root, resource, **kwargs): def __init__(self, url_or_fetch_strategy, root, resource, **kwargs):
super(ResourceStage, self).__init__(url_or_fetch_strategy, **kwargs) super().__init__(url_or_fetch_strategy, **kwargs)
self.root_stage = root self.root_stage = root
self.resource = resource self.resource = resource
def restage(self): def restage(self):
super(ResourceStage, self).restage() super().restage()
self._add_to_root_stage() self._add_to_root_stage()
def expand_archive(self): def expand_archive(self):
super(ResourceStage, self).expand_archive() super().expand_archive()
self._add_to_root_stage() self._add_to_root_stage()
def _add_to_root_stage(self): def _add_to_root_stage(self):
@ -744,7 +744,7 @@ class StageComposite(pattern.Composite):
# #
def __init__(self): def __init__(self):
super(StageComposite, self).__init__( super().__init__(
[ [
"fetch", "fetch",
"create", "create",

View file

@ -125,7 +125,7 @@ def test_compiler_flags_from_config_are_grouped():
# Fake up a mock compiler where everything is defaulted. # Fake up a mock compiler where everything is defaulted.
class MockCompiler(Compiler): class MockCompiler(Compiler):
def __init__(self): def __init__(self):
super(MockCompiler, self).__init__( super().__init__(
cspec="badcompiler@1.0.0", cspec="badcompiler@1.0.0",
operating_system=default_compiler_entry["operating_system"], operating_system=default_compiler_entry["operating_system"],
target=None, target=None,
@ -142,7 +142,7 @@ def _get_compiler_link_paths(self, paths):
# Mock os.path.isdir so the link paths don't have to exist # Mock os.path.isdir so the link paths don't have to exist
old_isdir = os.path.isdir old_isdir = os.path.isdir
os.path.isdir = lambda x: True os.path.isdir = lambda x: True
ret = super(MockCompiler, self)._get_compiler_link_paths(paths) ret = super()._get_compiler_link_paths(paths)
os.path.isdir = old_isdir os.path.isdir = old_isdir
return ret return ret

View file

@ -830,7 +830,7 @@ class AssertLock(lk.Lock):
"""Test lock class that marks acquire/release events.""" """Test lock class that marks acquire/release events."""
def __init__(self, lock_path, vals): def __init__(self, lock_path, vals):
super(AssertLock, self).__init__(lock_path) super().__init__(lock_path)
self.vals = vals self.vals = vals
# assert hooks for subclasses # assert hooks for subclasses
@ -841,25 +841,25 @@ def __init__(self, lock_path, vals):
def acquire_read(self, timeout=None): def acquire_read(self, timeout=None):
self.assert_acquire_read() self.assert_acquire_read()
result = super(AssertLock, self).acquire_read(timeout) result = super().acquire_read(timeout)
self.vals["acquired_read"] = True self.vals["acquired_read"] = True
return result return result
def acquire_write(self, timeout=None): def acquire_write(self, timeout=None):
self.assert_acquire_write() self.assert_acquire_write()
result = super(AssertLock, self).acquire_write(timeout) result = super().acquire_write(timeout)
self.vals["acquired_write"] = True self.vals["acquired_write"] = True
return result return result
def release_read(self, release_fn=None): def release_read(self, release_fn=None):
self.assert_release_read() self.assert_release_read()
result = super(AssertLock, self).release_read(release_fn) result = super().release_read(release_fn)
self.vals["released_read"] = True self.vals["released_read"] = True
return result return result
def release_write(self, release_fn=None): def release_write(self, release_fn=None):
self.assert_release_write() self.assert_release_write()
result = super(AssertLock, self).release_write(release_fn) result = super().release_write(release_fn)
self.vals["released_write"] = True self.vals["released_write"] = True
return result return result

View file

@ -916,7 +916,7 @@ class UrlParseError(spack.error.SpackError):
"""Raised when the URL module can't parse something correctly.""" """Raised when the URL module can't parse something correctly."""
def __init__(self, msg, path): def __init__(self, msg, path):
super(UrlParseError, self).__init__(msg) super().__init__(msg)
self.path = path self.path = path
@ -924,13 +924,11 @@ class UndetectableVersionError(UrlParseError):
"""Raised when we can't parse a version from a string.""" """Raised when we can't parse a version from a string."""
def __init__(self, path): def __init__(self, path):
super(UndetectableVersionError, self).__init__("Couldn't detect version in: " + path, path) super().__init__("Couldn't detect version in: " + path, path)
class UndetectableNameError(UrlParseError): class UndetectableNameError(UrlParseError):
"""Raised when we can't parse a package name from a string.""" """Raised when we can't parse a package name from a string."""
def __init__(self, path): def __init__(self, path):
super(UndetectableNameError, self).__init__( super().__init__("Couldn't parse package name in: " + path, path)
"Couldn't parse package name in: " + path, path
)

View file

@ -496,7 +496,7 @@ class ElfDynamicSectionUpdateFailed(Exception):
def __init__(self, old, new): def __init__(self, old, new):
self.old = old self.old = old
self.new = new self.new = new
super(ElfDynamicSectionUpdateFailed, self).__init__( super().__init__(
"New rpath {} is longer than old rpath {}".format( "New rpath {} is longer than old rpath {}".format(
new.decode("utf-8"), old.decode("utf-8") new.decode("utf-8"), old.decode("utf-8")
) )

View file

@ -31,27 +31,27 @@ class Lock(llnl.util.lock.Lock):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Lock, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self._enable = spack.config.get("config:locks", sys.platform != "win32") self._enable = spack.config.get("config:locks", sys.platform != "win32")
def _lock(self, op, timeout=0): def _lock(self, op, timeout=0):
if self._enable: if self._enable:
return super(Lock, self)._lock(op, timeout) return super()._lock(op, timeout)
else: else:
return 0, 0 return 0, 0
def _unlock(self): def _unlock(self):
"""Unlock call that always succeeds.""" """Unlock call that always succeeds."""
if self._enable: if self._enable:
super(Lock, self)._unlock() super()._unlock()
def _debug(self, *args): def _debug(self, *args):
if self._enable: if self._enable:
super(Lock, self)._debug(*args) super()._debug(*args)
def cleanup(self, *args): def cleanup(self, *args):
if self._enable: if self._enable:
super(Lock, self).cleanup(*args) super().cleanup(*args)
def check_lock_safety(path): def check_lock_safety(path):

View file

@ -163,7 +163,7 @@ class InvalidModuleNameError(spack.error.SpackError):
"""Raised when we encounter a bad module name.""" """Raised when we encounter a bad module name."""
def __init__(self, name): def __init__(self, name):
super(InvalidModuleNameError, self).__init__("Invalid module name: " + name) super().__init__("Invalid module name: " + name)
self.name = name self.name = name
@ -171,9 +171,7 @@ class InvalidFullyQualifiedModuleNameError(spack.error.SpackError):
"""Raised when we encounter a bad full package name.""" """Raised when we encounter a bad full package name."""
def __init__(self, name): def __init__(self, name):
super(InvalidFullyQualifiedModuleNameError, self).__init__( super().__init__("Invalid fully qualified package name: " + name)
"Invalid fully qualified package name: " + name
)
self.name = name self.name = name

View file

@ -131,4 +131,4 @@ class Args(Bunch):
"""Subclass of Bunch to write argparse args more naturally.""" """Subclass of Bunch to write argparse args more naturally."""
def __init__(self, *flags, **kwargs): def __init__(self, *flags, **kwargs):
super(Args, self).__init__(flags=tuple(flags), kwargs=kwargs) super().__init__(flags=tuple(flags), kwargs=kwargs)

View file

@ -33,4 +33,4 @@ class SpackJSONError(spack.error.SpackError):
"""Raised when there are issues with JSON parsing.""" """Raised when there are issues with JSON parsing."""
def __init__(self, msg: str, json_error: BaseException): def __init__(self, msg: str, json_error: BaseException):
super(SpackJSONError, self).__init__(msg, str(json_error)) super().__init__(msg, str(json_error))

View file

@ -870,7 +870,5 @@ class NoNetworkConnectionError(SpackWebError):
"""Raised when an operation can't get an internet connection.""" """Raised when an operation can't get an internet connection."""
def __init__(self, message, url): def __init__(self, message, url):
super(NoNetworkConnectionError, self).__init__( super().__init__("No network connection: " + str(message), "URL was: " + str(url))
"No network connection: " + str(message), "URL was: " + str(url)
)
self.url = url self.url = url

View file

@ -422,7 +422,7 @@ def satisfies(self, other):
Returns: Returns:
bool: True or False bool: True or False
""" """
super_sat = super(MultiValuedVariant, self).satisfies(other) super_sat = super().satisfies(other)
if not super_sat: if not super_sat:
return False return False
@ -459,7 +459,7 @@ class SingleValuedVariant(AbstractVariant):
def _value_setter(self, value): def _value_setter(self, value):
# Treat the value as a multi-valued variant # Treat the value as a multi-valued variant
super(SingleValuedVariant, self)._value_setter(value) super()._value_setter(value)
# Then check if there's only a single value # Then check if there's only a single value
if len(self._value) != 1: if len(self._value) != 1:
@ -473,7 +473,7 @@ def __str__(self):
@implicit_variant_conversion @implicit_variant_conversion
def satisfies(self, other): def satisfies(self, other):
abstract_sat = super(SingleValuedVariant, self).satisfies(other) abstract_sat = super().satisfies(other)
return abstract_sat and ( return abstract_sat and (
self.value == other.value or other.value == "*" or self.value == "*" self.value == other.value or other.value == "*" or self.value == "*"
@ -546,7 +546,7 @@ class VariantMap(lang.HashableMap):
""" """
def __init__(self, spec): def __init__(self, spec):
super(VariantMap, self).__init__() super().__init__()
self.spec = spec self.spec = spec
def __setitem__(self, name, vspec): def __setitem__(self, name, vspec):
@ -567,7 +567,7 @@ def __setitem__(self, name, vspec):
raise KeyError(msg.format(name, vspec.name)) raise KeyError(msg.format(name, vspec.name))
# Set the item # Set the item
super(VariantMap, self).__setitem__(name, vspec) super().__setitem__(name, vspec)
def substitute(self, vspec): def substitute(self, vspec):
"""Substitutes the entry under ``vspec.name`` with ``vspec``. """Substitutes the entry under ``vspec.name`` with ``vspec``.
@ -580,7 +580,7 @@ def substitute(self, vspec):
raise KeyError(msg.format(vspec.name)) raise KeyError(msg.format(vspec.name))
# Set the item # Set the item
super(VariantMap, self).__setitem__(vspec.name, vspec) super().__setitem__(vspec.name, vspec)
def satisfies(self, other): def satisfies(self, other):
return all(k in self and self[k].satisfies(other[k]) for k in other) return all(k in self and self[k].satisfies(other[k]) for k in other)
@ -919,7 +919,7 @@ def __init__(self, spec, variants):
" has no such {0} [happened during concretization of {3}]" " has no such {0} [happened during concretization of {3}]"
) )
msg = msg.format(variant_str, comma_or(variants), spec.name, spec.root) msg = msg.format(variant_str, comma_or(variants), spec.name, spec.root)
super(UnknownVariantError, self).__init__(msg) super().__init__(msg)
class InconsistentValidationError(error.SpecError): class InconsistentValidationError(error.SpecError):
@ -927,7 +927,7 @@ class InconsistentValidationError(error.SpecError):
def __init__(self, vspec, variant): def __init__(self, vspec, variant):
msg = 'trying to validate variant "{0.name}" ' 'with the validator of "{1.name}"' msg = 'trying to validate variant "{0.name}" ' 'with the validator of "{1.name}"'
super(InconsistentValidationError, self).__init__(msg.format(vspec, variant)) super().__init__(msg.format(vspec, variant))
class MultipleValuesInExclusiveVariantError(error.SpecError, ValueError): class MultipleValuesInExclusiveVariantError(error.SpecError, ValueError):
@ -940,7 +940,7 @@ def __init__(self, variant, pkg):
pkg_info = "" pkg_info = ""
if pkg is not None: if pkg is not None:
pkg_info = ' in package "{0}"'.format(pkg.name) pkg_info = ' in package "{0}"'.format(pkg.name)
super(MultipleValuesInExclusiveVariantError, self).__init__(msg.format(variant, pkg_info)) super().__init__(msg.format(variant, pkg_info))
class InvalidVariantValueCombinationError(error.SpecError): class InvalidVariantValueCombinationError(error.SpecError):
@ -955,9 +955,7 @@ def __init__(self, variant, invalid_values, pkg):
pkg_info = "" pkg_info = ""
if pkg is not None: if pkg is not None:
pkg_info = ' in package "{0}"'.format(pkg.name) pkg_info = ' in package "{0}"'.format(pkg.name)
super(InvalidVariantValueError, self).__init__( super().__init__(msg.format(variant, invalid_values, pkg_info))
msg.format(variant, invalid_values, pkg_info)
)
class InvalidVariantForSpecError(error.SpecError): class InvalidVariantForSpecError(error.SpecError):
@ -966,11 +964,11 @@ class InvalidVariantForSpecError(error.SpecError):
def __init__(self, variant, when, spec): def __init__(self, variant, when, spec):
msg = "Invalid variant {0} for spec {1}.\n" msg = "Invalid variant {0} for spec {1}.\n"
msg += "{0} is only available for {1.name} when satisfying one of {2}." msg += "{0} is only available for {1.name} when satisfying one of {2}."
super(InvalidVariantForSpecError, self).__init__(msg.format(variant, spec, when)) super().__init__(msg.format(variant, spec, when))
class UnsatisfiableVariantSpecError(error.UnsatisfiableSpecError): class UnsatisfiableVariantSpecError(error.UnsatisfiableSpecError):
"""Raised when a spec variant conflicts with package constraints.""" """Raised when a spec variant conflicts with package constraints."""
def __init__(self, provided, required): def __init__(self, provided, required):
super(UnsatisfiableVariantSpecError, self).__init__(provided, required, "variant") super().__init__(provided, required, "variant")

View file

@ -16,7 +16,7 @@ class Inheritance(spack.pkg.builder.test.callbacks.Callbacks):
class GenericBuilder(spack.pkg.builder.test.callbacks.GenericBuilder): class GenericBuilder(spack.pkg.builder.test.callbacks.GenericBuilder):
def install(self, pkg, spec, prefix): def install(self, pkg, spec, prefix):
super(GenericBuilder, self).install(pkg, spec, prefix) super().install(pkg, spec, prefix)
os.environ["INHERITANCE_INSTALL_CALLED"] = "1" os.environ["INHERITANCE_INSTALL_CALLED"] = "1"
os.environ["INSTALL_VALUE"] = "INHERITANCE" os.environ["INSTALL_VALUE"] = "INHERITANCE"

View file

@ -31,7 +31,7 @@ def configure_args(self):
"""This override a function in the builder and construct the result using a method """This override a function in the builder and construct the result using a method
defined in this class and a super method defined in the builder. defined in this class and a super method defined in the builder.
""" """
return [self.foo()] + super(OldStyleAutotools, self).configure_args() return [self.foo()] + super().configure_args()
def foo(self): def foo(self):
return "--with-foo" return "--with-foo"

View file

@ -18,4 +18,4 @@ class OldStyleDerived(spack.pkg.builder.test.old_style_autotools.OldStyleAutotoo
version("1.0", md5="0123456789abcdef0123456789abcdef") version("1.0", md5="0123456789abcdef0123456789abcdef")
def configure_args(self): def configure_args(self):
return ["--with-bar"] + super(OldStyleDerived, self).configure_args() return ["--with-bar"] + super().configure_args()

View file

@ -17,7 +17,7 @@ class ArchiveFiles(AutotoolsPackage):
@property @property
def archive_files(self): def archive_files(self):
return super(ArchiveFiles, self).archive_files + ["../../outside.log"] return super().archive_files + ["../../outside.log"]
def autoreconf(self, spec, prefix): def autoreconf(self, spec, prefix):
pass pass

View file

@ -24,6 +24,6 @@ def install(self, spec, prefix):
# TODO (post-34236): "test" -> "test_callback" once remove "test" support # TODO (post-34236): "test" -> "test_callback" once remove "test" support
def test(self): def test(self):
super(PyTestCallback, self).test() super().test()
print("PyTestCallback test") print("PyTestCallback test")

View file

@ -43,7 +43,7 @@ class Amdblis(BlisBase):
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
args = super(Amdblis, self).configure_args() args = super().configure_args()
if spec.satisfies("+ilp64"): if spec.satisfies("+ilp64"):
args.append("--blas-int-size=64") args.append("--blas-int-size=64")
@ -62,7 +62,7 @@ def configure_args(self):
return args return args
def config_args(self): def config_args(self):
config_args = super(Amdblis, self).config_args() config_args = super().config_args()
# "amdzen" - A fat binary or multiarchitecture binary # "amdzen" - A fat binary or multiarchitecture binary
# support for 3.1 release onwards # support for 3.1 release onwards

View file

@ -73,7 +73,7 @@ def lapack_libs(self):
def configure_args(self): def configure_args(self):
"""configure_args function""" """configure_args function"""
args = super(Amdlibflame, self).configure_args() args = super().configure_args()
# From 3.2 version, amd optimized flags are encapsulated under: # From 3.2 version, amd optimized flags are encapsulated under:
# enable-amd-flags for gcc compiler # enable-amd-flags for gcc compiler

View file

@ -325,7 +325,7 @@ index c2f8c8e..eb89a73 100644
from . import Compiler from . import Compiler
class Gcc(Compiler): class Gcc(Compiler):
- def __init__(self, prod_mode): - def __init__(self, prod_mode):
- super(Gcc, self).__init__(prod_mode) - super().__init__(prod_mode)
- -
- warnings_cxx = [ - warnings_cxx = [
- '-Wctor-dtor-privacy', - '-Wctor-dtor-privacy',
@ -334,7 +334,7 @@ index c2f8c8e..eb89a73 100644
- '-Wold-style-cast', - '-Wold-style-cast',
- '-Woverloaded-virtual', - '-Woverloaded-virtual',
+ def __init__(self, prod_mode, bvars = None, opts = None): + def __init__(self, prod_mode, bvars = None, opts = None):
+ super(Gcc, self).__init__(prod_mode, bvars, opts) + super().__init__(prod_mode, bvars, opts)
+ self.cmd = 'gcc' + self.cmd = 'gcc'
+ self.cxxcmd = 'g++' + self.cxxcmd = 'g++'
+ self.compile_flags_debug = [ + self.compile_flags_debug = [
@ -474,13 +474,13 @@ index 0e4c346..b39d341 100644
class LLVM(Compiler): class LLVM(Compiler):
- def __init__(self, prod_mode): - def __init__(self, prod_mode):
- super(LLVM, self).__init__(prod_mode) - super().__init__(prod_mode)
- -
- compile_flags_release = [ - compile_flags_release = [
- # fp-contract needed to generate FMA instructions - # fp-contract needed to generate FMA instructions
- '-ffp-contract=fast', - '-ffp-contract=fast',
+ def __init__(self, prod_mode, bvars = None, opts = None): + def __init__(self, prod_mode, bvars = None, opts = None):
+ super(LLVM, self).__init__(prod_mode, bvars, opts) + super().__init__(prod_mode, bvars, opts)
+ self.cmd = 'clang' + self.cmd = 'clang'
+ self.cxxcmd = 'clang++' + self.cxxcmd = 'clang++'
+ self.compile_flags_debug = [ + self.compile_flags_debug = [

View file

@ -49,7 +49,7 @@ def url_for_version(self, version):
def cmake_args(self): def cmake_args(self):
"""cmake_args function""" """cmake_args function"""
args = super(Amdscalapack, self).cmake_args() args = super().cmake_args()
spec = self.spec spec = self.spec
if spec.satisfies("%gcc@10:"): if spec.satisfies("%gcc@10:"):

View file

@ -206,7 +206,7 @@ def cache_name(self):
def initconfig_compiler_entries(self): def initconfig_compiler_entries(self):
spec = self.spec spec = self.spec
entries = super(Axom, self).initconfig_compiler_entries() entries = super().initconfig_compiler_entries()
if "+fortran" in spec: if "+fortran" in spec:
entries.append(cmake_cache_option("ENABLE_FORTRAN", True)) entries.append(cmake_cache_option("ENABLE_FORTRAN", True))
@ -229,7 +229,7 @@ def initconfig_compiler_entries(self):
def initconfig_hardware_entries(self): def initconfig_hardware_entries(self):
spec = self.spec spec = self.spec
entries = super(Axom, self).initconfig_hardware_entries() entries = super().initconfig_hardware_entries()
if "+cuda" in spec: if "+cuda" in spec:
entries.append(cmake_cache_option("ENABLE_CUDA", True)) entries.append(cmake_cache_option("ENABLE_CUDA", True))
@ -352,7 +352,7 @@ def initconfig_hardware_entries(self):
def initconfig_mpi_entries(self): def initconfig_mpi_entries(self):
spec = self.spec spec = self.spec
entries = super(Axom, self).initconfig_mpi_entries() entries = super().initconfig_mpi_entries()
if "+mpi" in spec: if "+mpi" in spec:
entries.append(cmake_cache_option("ENABLE_MPI", True)) entries.append(cmake_cache_option("ENABLE_MPI", True))

View file

@ -70,7 +70,7 @@ def do_stage(self, mirror_only=False):
# wrap (decorate) the standard expand_archive step with a # wrap (decorate) the standard expand_archive step with a
# helper, then call the real do_stage(). # helper, then call the real do_stage().
self.stage.expand_archive = self.unpack_it(self.stage.expand_archive) self.stage.expand_archive = self.unpack_it(self.stage.expand_archive)
super(Bcl2fastq2, self).do_stage(mirror_only) super().do_stage(mirror_only)
def unpack_it(self, f): def unpack_it(self, f):
def wrap(): def wrap():

View file

@ -44,14 +44,14 @@ def install(self, spec, prefix):
if self.spec.satisfies("@4.1.3:"): if self.spec.satisfies("@4.1.3:"):
install_tree("bin", prefix.bin) install_tree("bin", prefix.bin)
install_tree("config", prefix.config) install_tree("config", prefix.config)
super(Busco, self).install(spec, prefix) super().install(spec, prefix)
if self.spec.satisfies("@3.0.1"): if self.spec.satisfies("@3.0.1"):
with working_dir("scripts"): with working_dir("scripts"):
mkdirp(prefix.bin) mkdirp(prefix.bin)
install("generate_plot.py", prefix.bin) install("generate_plot.py", prefix.bin)
install("run_BUSCO.py", prefix.bin) install("run_BUSCO.py", prefix.bin)
install_tree("config", prefix.config) install_tree("config", prefix.config)
super(Busco, self).install(spec, prefix) super().install(spec, prefix)
if self.spec.satisfies("@2.0.1"): if self.spec.satisfies("@2.0.1"):
mkdirp(prefix.bin) mkdirp(prefix.bin)
install("BUSCO.py", prefix.bin) install("BUSCO.py", prefix.bin)

View file

@ -86,7 +86,7 @@ def editions(self):
def do_stage(self, mirror_only=False): def do_stage(self, mirror_only=False):
"""Unpacks and expands the fetched tarball. """Unpacks and expands the fetched tarball.
Then, generate the catalyst source files.""" Then, generate the catalyst source files."""
super(Catalyst, self).do_stage(mirror_only) super().do_stage(mirror_only)
# extract the catalyst part # extract the catalyst part
catalyst_script = os.path.join(self.stage.source_path, "Catalyst", "catalyze.py") catalyst_script = os.path.join(self.stage.source_path, "Catalyst", "catalyze.py")

View file

@ -33,7 +33,7 @@ class Cfitsio(AutotoolsPackage):
def url_for_version(self, version): def url_for_version(self, version):
if version >= Version("3.47"): if version >= Version("3.47"):
return super(Cfitsio, self).url_for_version(version) return super().url_for_version(version)
url = "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio{0}0.tar.gz" url = "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio{0}0.tar.gz"
return url.format(version.joined) return url.format(version.joined)

View file

@ -114,14 +114,14 @@ def cache_name(self):
def initconfig_compiler_entries(self): def initconfig_compiler_entries(self):
spec = self.spec spec = self.spec
entries = super(Chai, self).initconfig_compiler_entries() entries = super().initconfig_compiler_entries()
if "+rocm" in spec: if "+rocm" in spec:
entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc))
return entries return entries
def initconfig_hardware_entries(self): def initconfig_hardware_entries(self):
spec = self.spec spec = self.spec
entries = super(Chai, self).initconfig_hardware_entries() entries = super().initconfig_hardware_entries()
entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec))

View file

@ -50,7 +50,7 @@ def cmake_py_shared(self):
return self.define("CLINGO_BUILD_PY_SHARED", "OFF") return self.define("CLINGO_BUILD_PY_SHARED", "OFF")
def cmake_args(self): def cmake_args(self):
args = super(ClingoBootstrap, self).cmake_args() args = super().cmake_args()
args.extend( args.extend(
[ [
# Avoid building the clingo executable # Avoid building the clingo executable

View file

@ -705,7 +705,7 @@ def build(self, spec, prefix):
# Apparently the Makefile bases its paths on PWD # Apparently the Makefile bases its paths on PWD
# so we need to set PWD = self.build_directory # so we need to set PWD = self.build_directory
with spack.util.environment.set_env(PWD=self.build_directory): with spack.util.environment.set_env(PWD=self.build_directory):
super(Cp2k, self).build(spec, prefix) super().build(spec, prefix)
with working_dir(self.build_directory): with working_dir(self.build_directory):
make("libcp2k", *self.build_targets) make("libcp2k", *self.build_targets)

View file

@ -47,7 +47,7 @@ def cmake_args(self):
return args return args
def install(self, spec, prefix): def install(self, spec, prefix):
super(Cppcheck, self).install(spec, prefix) super().install(spec, prefix)
# Manually install the final cppcheck binary # Manually install the final cppcheck binary
if spec.satisfies("+htmlreport"): if spec.satisfies("+htmlreport"):
install("htmlreport/cppcheck-htmlreport", prefix.bin) install("htmlreport/cppcheck-htmlreport", prefix.bin)

View file

@ -22,7 +22,7 @@ def url_for_version(self, version):
if version < Version("4.7.0"): if version < Version("4.7.0"):
self.gnu_mirror_path = "findutils/findutils-{0}.tar.gz".format(version) self.gnu_mirror_path = "findutils/findutils-{0}.tar.gz".format(version)
return super(Findutils, self).url_for_version(version) return super().url_for_version(version)
executables = ["^find$"] executables = ["^find$"]

View file

@ -32,7 +32,7 @@ def url_for_version(self, version):
def cmake_args(self): def cmake_args(self):
define = self.define define = self.define
args = super(FujitsuFrontistr, self).cmake_args() args = super().cmake_args()
if self.spec.satisfies("%fj"): if self.spec.satisfies("%fj"):
args.extend( args.extend(
[ [

View file

@ -628,7 +628,7 @@ def url_for_version(self, version):
"7.1.0" "7.1.0"
): ):
self.gnu_mirror_path = self.gnu_mirror_path.replace("xz", "bz2") self.gnu_mirror_path = self.gnu_mirror_path.replace("xz", "bz2")
return super(Gcc, self).url_for_version(version) return super().url_for_version(version)
def patch(self): def patch(self):
spec = self.spec spec = self.spec

View file

@ -57,7 +57,7 @@ def cmake_args(self):
return args return args
def install(self, spec, prefix): def install(self, spec, prefix):
super(Gchp, self).install(spec, prefix) super().install(spec, prefix)
# Preserve source code in prefix for two reasons: # Preserve source code in prefix for two reasons:
# 1. Run directory creation occurs independently of code compilation, # 1. Run directory creation occurs independently of code compilation,
# possibly multiple times depending on user needs, # possibly multiple times depending on user needs,

View file

@ -88,11 +88,11 @@ def url_for_version(self, version):
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.set("GENIE", self.stage.source_path) env.set("GENIE", self.stage.source_path)
return super(Genie, self).setup_build_environment(env) return super().setup_build_environment(env)
def setup_run_environment(self, env): def setup_run_environment(self, env):
env.set("GENIE", self.prefix) env.set("GENIE", self.prefix)
return super(Genie, self).setup_run_environment(env) return super().setup_run_environment(env)
def install(self, spec, prefix): def install(self, spec, prefix):
configure = Executable("./configure") configure = Executable("./configure")

View file

@ -152,7 +152,7 @@ def autoreconf(self, spec, prefix):
def setup_build_environment(self, env): def setup_build_environment(self, env):
# Set MACOSX_DEPLOYMENT_TARGET to 10.x due to old configure # Set MACOSX_DEPLOYMENT_TARGET to 10.x due to old configure
super(Graphviz, self).setup_build_environment(env) super().setup_build_environment(env)
if "+quartz" in self.spec: if "+quartz" in self.spec:
env.set("OBJC", self.compiler.cc) env.set("OBJC", self.compiler.cc)

View file

@ -45,7 +45,7 @@ def remove_parent_versions(self):
del self.versions[version_key] del self.versions[version_key]
def __init__(self, spec): def __init__(self, spec):
super(GromacsChainCoordinate, self).__init__(spec) super().__init__(spec)
self.remove_parent_versions() self.remove_parent_versions()

View file

@ -148,6 +148,6 @@ def remove_parent_versions(self):
del self.versions[version_key] del self.versions[version_key]
def __init__(self, spec): def __init__(self, spec):
super(GromacsSwaxs, self).__init__(spec) super().__init__(spec)
self.remove_parent_versions() self.remove_parent_versions()

View file

@ -232,6 +232,6 @@ def cmake_args(self):
return args return args
def __init__(self, spec): def __init__(self, spec):
super(HipRocclr, self).__init__(spec) super().__init__(spec)
if self.spec.satisfies("@4.5.0:"): if self.spec.satisfies("@4.5.0:"):
self.phases = ["cmake", "build"] self.phases = ["cmake", "build"]

View file

@ -146,7 +146,7 @@ def setup_dependent_build_environment(self, *args):
) )
def setup_run_environment(self, env): def setup_run_environment(self, env):
super(IntelMpi, self).setup_run_environment(env) super().setup_run_environment(env)
for name, value in self.mpi_compiler_wrappers.items(): for name, value in self.mpi_compiler_wrappers.items():
env.set(name, value) env.set(name, value)

View file

@ -183,7 +183,7 @@ def setup_run_environment(self, env):
and from setting CC/CXX/F77/FC and from setting CC/CXX/F77/FC
""" """
super(IntelOneapiCompilers, self).setup_run_environment(env) super().setup_run_environment(env)
env.set("CC", self.component_prefix.linux.bin.icx) env.set("CC", self.component_prefix.linux.bin.icx)
env.set("CXX", self.component_prefix.linux.bin.icpx) env.set("CXX", self.component_prefix.linux.bin.icpx)
@ -195,7 +195,7 @@ def install(self, spec, prefix):
# install_tree("/opt/intel/oneapi/compiler", self.prefix) # install_tree("/opt/intel/oneapi/compiler", self.prefix)
# install cpp # install cpp
super(IntelOneapiCompilers, self).install(spec, prefix) super().install(spec, prefix)
# install fortran # install fortran
self.install_component(find("fortran-installer", "*")[0]) self.install_component(find("fortran-installer", "*")[0])

View file

@ -136,7 +136,7 @@ def libs(self):
return IntelOneApiStaticLibraryList(libs, system_libs) return IntelOneApiStaticLibraryList(libs, system_libs)
def setup_run_environment(self, env): def setup_run_environment(self, env):
super(IntelOneapiMkl, self).setup_run_environment(env) super().setup_run_environment(env)
# Support RPATH injection to the library directories when the '-mkl' or '-qmkl' # Support RPATH injection to the library directories when the '-mkl' or '-qmkl'
# flag of the Intel compilers are used outside the Spack build environment. We # flag of the Intel compilers are used outside the Spack build environment. We

View file

@ -596,7 +596,7 @@ def setup_dependent_build_environment(self, *args):
) )
def setup_run_environment(self, env): def setup_run_environment(self, env):
super(IntelParallelStudio, self).setup_run_environment(env) super().setup_run_environment(env)
for name, value in self.mpi_compiler_wrappers.items(): for name, value in self.mpi_compiler_wrappers.items():
env.set(name, value) env.set(name, value)

View file

@ -57,7 +57,7 @@ def std_cmake_args(self):
"""Call the original std_cmake_args and then filter the verbose """Call the original std_cmake_args and then filter the verbose
setting. setting.
""" """
a = super(Kallisto, self).std_cmake_args a = super().std_cmake_args
if self.spec.satisfies("@0.44.0:"): if self.spec.satisfies("@0.44.0:"):
args = [i for i in a if i != "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"] args = [i for i in a if i != "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"]
if self.spec.satisfies("@0.46.2:"): if self.spec.satisfies("@0.46.2:"):

View file

@ -347,7 +347,7 @@ def cache_name(self):
def initconfig_compiler_entries(self): def initconfig_compiler_entries(self):
spec = self.spec spec = self.spec
entries = super(Lbann, self).initconfig_compiler_entries() entries = super().initconfig_compiler_entries()
entries.append(cmake_cache_string("CMAKE_CXX_STANDARD", "17")) entries.append(cmake_cache_string("CMAKE_CXX_STANDARD", "17"))
if not spec.satisfies("^cmake@3.23.0"): if not spec.satisfies("^cmake@3.23.0"):
# There is a bug with using Ninja generator in this version # There is a bug with using Ninja generator in this version
@ -368,7 +368,7 @@ def initconfig_compiler_entries(self):
def initconfig_hardware_entries(self): def initconfig_hardware_entries(self):
spec = self.spec spec = self.spec
entries = super(Lbann, self).initconfig_hardware_entries() entries = super().initconfig_hardware_entries()
if "+cuda" in spec: if "+cuda" in spec:
if self.spec.satisfies("%clang"): if self.spec.satisfies("%clang"):

View file

@ -29,7 +29,7 @@ class Libpsl(AutotoolsPackage):
def url_for_version(self, version): def url_for_version(self, version):
if version >= Version("0.21.1"): if version >= Version("0.21.1"):
return super(Libpsl, self).url_for_version(version) return super().url_for_version(version)
url_fmt = ( url_fmt = (
"https://github.com/rockdaboot/libpsl/releases/download/libpsl-{0}/libpsl-{0}.tar.gz" "https://github.com/rockdaboot/libpsl/releases/download/libpsl-{0}/libpsl-{0}.tar.gz"
) )

View file

@ -29,7 +29,7 @@ class LuaImplPackage(MakefilePackage):
lua_version_override = None lua_version_override = None
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(LuaImplPackage, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.lua_dir_name = "lua" self.lua_dir_name = "lua"
pass pass

View file

@ -153,7 +153,7 @@ def flag_handler(self, name, flags):
if self.spec.satisfies("%intel"): if self.spec.satisfies("%intel"):
if name == "cflags": if name == "cflags":
flags.append("-std=c99") flags.append("-std=c99")
return super(Mesa, self).flag_handler(name, flags) return super().flag_handler(name, flags)
@property @property
def libglx_headers(self): def libglx_headers(self):

View file

@ -57,7 +57,7 @@ def mumax_gopath_dir(self):
return join_path(self.gopath, "src/github.com/mumax/3") return join_path(self.gopath, "src/github.com/mumax/3")
def do_stage(self, mirror_only=False): def do_stage(self, mirror_only=False):
super(Mumax, self).do_stage(mirror_only) super().do_stage(mirror_only)
if not os.path.exists(self.mumax_gopath_dir): if not os.path.exists(self.mumax_gopath_dir):
# Need to move source to $GOPATH and then symlink the original # Need to move source to $GOPATH and then symlink the original
# stage directory # stage directory

View file

@ -45,4 +45,4 @@ def configure_args(self):
def install(self, spec, prefix): def install(self, spec, prefix):
os.makedirs(os.path.join(prefix, "lib/systemd/system")) os.makedirs(os.path.join(prefix, "lib/systemd/system"))
super(Munge, self).install(spec, prefix) super().install(spec, prefix)

Some files were not shown because too many files have changed in this diff Show more