From cb1adaa8a04d02ea3915e628eb388ff54ace7096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Wed, 17 Mar 2021 16:57:44 +0000 Subject: [PATCH] Support Module::Build::Tiny. --- README.md | 2 ++ ognibuild/buildsystem.py | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c595135..39b2ddc 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ issues (or lack of support for a particular ecosystem), please file a bug. - ninja, including ninja file generators: - meson - Node +- Perl + - Module::Build::Tiny - PHP Pear - Python - setup.py/setup.cfg/pyproject.toml - Ruby gems diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index 650b51a..a3dd10f 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -810,9 +810,47 @@ class Cabal(BuildSystem): return cls(os.path.join(path, "Setup.hs")) +class PerlBuildTiny(BuildSystem): + + name = "perl-build-tiny" + + def __init__(self, path): + self.path = path + + def __repr__(self): + return "%s(%r)" % (type(self).__name__, self.path) + + def setup(self, session, fixers): + run_with_build_fixers(session, ["perl", "Build.PL"], fixers) + + def test(self, session, resolver, fixers): + self.setup(session, fixers) + run_with_build_fixers(session, ["./Build", "test"], fixers) + + def build(self, session, resolver, fixers): + self.setup(session, fixers) + run_with_build_fixers(session, ["./Build", "build"], fixers) + + def clean(self, session, resolver, fixers): + self.setup(session, fixers) + run_with_build_fixers(session, ["./Build", "clean"], fixers) + + def install(self, session, resolver, fixers, install_target): + self.setup(session, fixers) + run_with_build_fixers(session, ["./Build", "install"], fixers) + + @classmethod + def probe(cls, path): + if os.path.exists(os.path.join(path, "Build.PL")): + logging.debug("Found Build.PL, assuming Module::Build::Tiny package.") + return cls(path) + + def detect_buildsystems(path, trust_package=False): # noqa: C901 """Detect build systems.""" - for bs_cls in [Pear, SetupPy, Npm, Waf, Cargo, Meson, Cabal, Gradle, Maven, DistInkt, Gem, Make]: + for bs_cls in [ + Pear, SetupPy, Npm, Waf, Cargo, Meson, Cabal, Gradle, Maven, + DistInkt, Gem, Make, PerlBuildTiny]: bs = bs_cls.probe(path) if bs is not None: yield bs