Use the maintainers directive in all base classes (#35324)

* Use the `maintainers` directive in all base classes
* Update unit tests
This commit is contained in:
Adam J. Stewart 2023-02-15 02:33:29 -07:00 committed by GitHub
parent 1894b64851
commit dd434ec413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 13 deletions

View file

@ -21,7 +21,7 @@
import spack.package_base import spack.package_base
import spack.spec import spack.spec
import spack.store 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.error import NoHeadersError, NoLibrariesError, SpecError
from spack.version import Version from spack.version import Version
@ -29,7 +29,7 @@
class PythonExtension(spack.package_base.PackageBase): class PythonExtension(spack.package_base.PackageBase):
maintainers = ["adamjstewart"] maintainers("adamjstewart", "pradyunsg")
@property @property
def import_modules(self): def import_modules(self):
@ -184,8 +184,6 @@ class PythonPackage(PythonExtension):
#: Package name, version, and extension on PyPI #: Package name, version, and extension on PyPI
pypi: Optional[str] = None pypi: Optional[str] = None
maintainers = ["adamjstewart", "pradyunsg"]
# To be used in UI queries that require to know which # To be used in UI queries that require to know which
# build-system class we are using # build-system class we are using
build_system_class = "PythonPackage" build_system_class = "PythonPackage"

View file

@ -7,7 +7,7 @@
import llnl.util.lang as lang import llnl.util.lang as lang
from spack.directives import extends from spack.directives import extends, maintainers
from .generic import GenericBuilder, Package from .generic import GenericBuilder, Package
@ -71,7 +71,7 @@ class RPackage(Package):
GenericBuilder = RBuilder GenericBuilder = RBuilder
maintainers = ["glennpj"] maintainers("glennpj")
#: This attribute is used in UI queries that need to know the build #: This attribute is used in UI queries that need to know the build
#: system base class #: system base class

View file

@ -11,7 +11,7 @@
import spack.builder import spack.builder
from spack.build_environment import SPACK_NO_PARALLEL_MAKE, determine_number_of_jobs 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.package_base import PackageBase
from spack.util.environment import env_flag from spack.util.environment import env_flag
from spack.util.executable import Executable, ProcessError from spack.util.executable import Executable, ProcessError
@ -23,7 +23,7 @@ class RacketPackage(PackageBase):
""" """
#: Package name, version, and extension on PyPI #: Package name, version, and extension on PyPI
maintainers = ["elfprince13"] maintainers("elfprince13")
# To be used in UI queries that require to know which # To be used in UI queries that require to know which
# build-system class we are using # build-system class we are using
build_system_class = "RacketPackage" build_system_class = "RacketPackage"

View file

@ -7,7 +7,7 @@
import spack.builder import spack.builder
import spack.package_base import spack.package_base
from spack.directives import build_system, extends from spack.directives import build_system, extends, maintainers
from ._checks import BaseBuilder from ._checks import BaseBuilder
@ -15,7 +15,7 @@
class RubyPackage(spack.package_base.PackageBase): class RubyPackage(spack.package_base.PackageBase):
"""Specialized class for building Ruby gems.""" """Specialized class for building Ruby gems."""
maintainers = ["Kerilk"] maintainers("Kerilk")
#: This attribute is used in UI queries that need to know the build #: This attribute is used in UI queries that need to know the build
#: system base class #: system base class

View file

@ -14,7 +14,13 @@
maintainers = spack.main.SpackCommand("maintainers") 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): def split(output):
@ -53,6 +59,9 @@ def test_all(mock_packages, capfd):
"pradyunsg,", "pradyunsg,",
"user1,", "user1,",
"user2", "user2",
"py-extension2:",
"adamjstewart,",
"pradyunsg",
] ]
with capfd.disabled(): with capfd.disabled():
@ -69,9 +78,11 @@ def test_all_by_user(mock_packages, capfd):
out = split(maintainers("--all", "--by-user")) out = split(maintainers("--all", "--by-user"))
assert out == [ assert out == [
"adamjstewart:", "adamjstewart:",
"py-extension1", "py-extension1,",
"py-extension2",
"pradyunsg:", "pradyunsg:",
"py-extension1", "py-extension1,",
"py-extension2",
"user0:", "user0:",
"maintainers-3", "maintainers-3",
"user1:", "user1:",