Support Module::Build::Tiny.

This commit is contained in:
Jelmer Vernooij 2021-03-17 16:57:44 +00:00
parent 4c40bc69d1
commit cb1adaa8a0
2 changed files with 41 additions and 1 deletions

View file

@ -51,6 +51,8 @@ issues (or lack of support for a particular ecosystem), please file a bug.
- ninja, including ninja file generators: - ninja, including ninja file generators:
- meson - meson
- Node - Node
- Perl
- Module::Build::Tiny
- PHP Pear - PHP Pear
- Python - setup.py/setup.cfg/pyproject.toml - Python - setup.py/setup.cfg/pyproject.toml
- Ruby gems - Ruby gems

View file

@ -810,9 +810,47 @@ class Cabal(BuildSystem):
return cls(os.path.join(path, "Setup.hs")) 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 def detect_buildsystems(path, trust_package=False): # noqa: C901
"""Detect build systems.""" """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) bs = bs_cls.probe(path)
if bs is not None: if bs is not None:
yield bs yield bs