From dd434ec413d07b86f3735a80db8d37a7a7a5d221 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 15 Feb 2023 02:33:29 -0700 Subject: [PATCH] Use the `maintainers` directive in all base classes (#35324) * Use the `maintainers` directive in all base classes * Update unit tests --- lib/spack/spack/build_systems/python.py | 6 ++---- lib/spack/spack/build_systems/r.py | 4 ++-- lib/spack/spack/build_systems/racket.py | 4 ++-- lib/spack/spack/build_systems/ruby.py | 4 ++-- lib/spack/spack/test/cmd/maintainers.py | 17 ++++++++++++++--- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index 84caebefc6..666c73f739 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -21,7 +21,7 @@ import spack.package_base import spack.spec import spack.store -from spack.directives import build_system, depends_on, extends +from spack.directives import build_system, depends_on, extends, maintainers from spack.error import NoHeadersError, NoLibrariesError, SpecError from spack.version import Version @@ -29,7 +29,7 @@ class PythonExtension(spack.package_base.PackageBase): - maintainers = ["adamjstewart"] + maintainers("adamjstewart", "pradyunsg") @property def import_modules(self): @@ -184,8 +184,6 @@ class PythonPackage(PythonExtension): #: Package name, version, and extension on PyPI pypi: Optional[str] = None - maintainers = ["adamjstewart", "pradyunsg"] - # To be used in UI queries that require to know which # build-system class we are using build_system_class = "PythonPackage" diff --git a/lib/spack/spack/build_systems/r.py b/lib/spack/spack/build_systems/r.py index 6b8ed23cac..c6801d00f7 100644 --- a/lib/spack/spack/build_systems/r.py +++ b/lib/spack/spack/build_systems/r.py @@ -7,7 +7,7 @@ import llnl.util.lang as lang -from spack.directives import extends +from spack.directives import extends, maintainers from .generic import GenericBuilder, Package @@ -71,7 +71,7 @@ class RPackage(Package): GenericBuilder = RBuilder - maintainers = ["glennpj"] + maintainers("glennpj") #: This attribute is used in UI queries that need to know the build #: system base class diff --git a/lib/spack/spack/build_systems/racket.py b/lib/spack/spack/build_systems/racket.py index a30a3f63d9..8a07773a29 100644 --- a/lib/spack/spack/build_systems/racket.py +++ b/lib/spack/spack/build_systems/racket.py @@ -11,7 +11,7 @@ import spack.builder from spack.build_environment import SPACK_NO_PARALLEL_MAKE, determine_number_of_jobs -from spack.directives import build_system, extends +from spack.directives import build_system, extends, maintainers from spack.package_base import PackageBase from spack.util.environment import env_flag from spack.util.executable import Executable, ProcessError @@ -23,7 +23,7 @@ class RacketPackage(PackageBase): """ #: Package name, version, and extension on PyPI - maintainers = ["elfprince13"] + maintainers("elfprince13") # To be used in UI queries that require to know which # build-system class we are using build_system_class = "RacketPackage" diff --git a/lib/spack/spack/build_systems/ruby.py b/lib/spack/spack/build_systems/ruby.py index 82d82da8f5..ef99259f86 100644 --- a/lib/spack/spack/build_systems/ruby.py +++ b/lib/spack/spack/build_systems/ruby.py @@ -7,7 +7,7 @@ import spack.builder import spack.package_base -from spack.directives import build_system, extends +from spack.directives import build_system, extends, maintainers from ._checks import BaseBuilder @@ -15,7 +15,7 @@ class RubyPackage(spack.package_base.PackageBase): """Specialized class for building Ruby gems.""" - maintainers = ["Kerilk"] + maintainers("Kerilk") #: This attribute is used in UI queries that need to know the build #: system base class diff --git a/lib/spack/spack/test/cmd/maintainers.py b/lib/spack/spack/test/cmd/maintainers.py index 2c9393ef28..e3452a5667 100644 --- a/lib/spack/spack/test/cmd/maintainers.py +++ b/lib/spack/spack/test/cmd/maintainers.py @@ -14,7 +14,13 @@ maintainers = spack.main.SpackCommand("maintainers") -MAINTAINED_PACKAGES = ["maintainers-1", "maintainers-2", "maintainers-3", "py-extension1"] +MAINTAINED_PACKAGES = [ + "maintainers-1", + "maintainers-2", + "maintainers-3", + "py-extension1", + "py-extension2", +] def split(output): @@ -53,6 +59,9 @@ def test_all(mock_packages, capfd): "pradyunsg,", "user1,", "user2", + "py-extension2:", + "adamjstewart,", + "pradyunsg", ] with capfd.disabled(): @@ -69,9 +78,11 @@ def test_all_by_user(mock_packages, capfd): out = split(maintainers("--all", "--by-user")) assert out == [ "adamjstewart:", - "py-extension1", + "py-extension1,", + "py-extension2", "pradyunsg:", - "py-extension1", + "py-extension1,", + "py-extension2", "user0:", "maintainers-3", "user1:",