diff options
author | Christopher Christofi <77968333+ChristopherChristofi@users.noreply.github.com> | 2023-12-20 17:42:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 09:42:45 -0800 |
commit | 3053e701c02fd57b0a3aa169abd57b144edf827b (patch) | |
tree | f263a3f3aa97725fd2f084ddf5a5758a729a4b98 /lib | |
parent | 20572fb87b853e716ea892aec0af354d0b0db727 (diff) | |
download | spack-3053e701c02fd57b0a3aa169abd57b144edf827b.tar.gz spack-3053e701c02fd57b0a3aa169abd57b144edf827b.tar.bz2 spack-3053e701c02fd57b0a3aa169abd57b144edf827b.tar.xz spack-3053e701c02fd57b0a3aa169abd57b144edf827b.zip |
fix attribute error in perl build-system (#41628)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/perl.py | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/spack/spack/build_systems/perl.py b/lib/spack/spack/build_systems/perl.py index 53787316c4..074b3ac4d9 100644 --- a/lib/spack/spack/build_systems/perl.py +++ b/lib/spack/spack/build_systems/perl.py @@ -10,13 +10,12 @@ from llnl.util.filesystem import filter_file import spack.builder import spack.package_base from spack.directives import build_system, extends -from spack.package_base import PackageBase from spack.util.executable import Executable from ._checks import BaseBuilder, execute_build_time_tests -class PerlPackage(PackageBase): +class PerlPackage(spack.package_base.PackageBase): """Specialized class for packages that are built using Perl.""" #: This attribute is used in UI queries that need to know the build @@ -61,6 +60,30 @@ class PerlBuilder(BaseBuilder): #: Callback names for build-time test build_time_test_callbacks = ["check"] + @property + def build_method(self): + """Searches the package for either a Makefile.PL or Build.PL. + + Raises: + RuntimeError: if neither Makefile.PL nor Build.PL exist + """ + if os.path.isfile("Makefile.PL"): + build_method = "Makefile.PL" + elif os.path.isfile("Build.PL"): + build_method = "Build.PL" + else: + raise RuntimeError("Unknown build_method for perl package") + return build_method + + @property + def build_executable(self): + """Returns the executable method to build the perl package""" + if self.build_method == "Makefile.PL": + build_executable = inspect.getmodule(self.pkg).make + elif self.build_method == "Build.PL": + build_executable = Executable(os.path.join(self.pkg.stage.source_path, "Build")) + return build_executable + def configure_args(self): """List of arguments passed to :py:meth:`~.PerlBuilder.configure`. @@ -73,19 +96,7 @@ class PerlBuilder(BaseBuilder): """Run Makefile.PL or Build.PL with arguments consisting of an appropriate installation base directory followed by the list returned by :py:meth:`~.PerlBuilder.configure_args`. - - Raises: - RuntimeError: if neither Makefile.PL nor Build.PL exist """ - if os.path.isfile("Makefile.PL"): - self.build_method = "Makefile.PL" - self.build_executable = inspect.getmodule(self.pkg).make - elif os.path.isfile("Build.PL"): - self.build_method = "Build.PL" - self.build_executable = Executable(os.path.join(self.pkg.stage.source_path, "Build")) - else: - raise RuntimeError("Unknown build_method for perl package") - if self.build_method == "Makefile.PL": options = ["Makefile.PL", "INSTALL_BASE={0}".format(prefix)] elif self.build_method == "Build.PL": |