From 08e433b0f801ad7fff05f353b86acd01f3491b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Mon, 22 Mar 2021 14:39:48 +0000 Subject: [PATCH] Add basic Octave support. --- ognibuild/buildsystem.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index cd2e010..20e703a 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -441,6 +441,38 @@ class SetupPy(BuildSystem): return cls(path) +class Octave(BuildSystem): + + name = "octave" + + def __init__(self, path): + self.path = path + + def __repr__(self): + return "%s(%r)" % (type(self).__name__, self.path) + + @classmethod + def exists(cls, path): + if not ( + os.path.exists(os.path.join(path, "DESCRIPTION")) and + os.path.exists(os.path.join(path, "COPYING"))): + return False + # Urgh, isn't there a better way to see if this is an octave package? + for entry in os.scandir(path): + if not entry.is_dir(): + continue + for subentry in os.scandir(entry.path): + if subentry.name.endswith('.m'): + return True + return False + + @classmethod + def probe(cls, path): + if cls.exists(path): + logging.debug("Found DESCRIPTION and COPYING, assuming octave package.") + return cls(path) + + class Gradle(BuildSystem): name = "gradle" @@ -1060,7 +1092,7 @@ class PerlBuildTiny(BuildSystem): BUILDSYSTEM_CLSES = [ Pear, SetupPy, Npm, Waf, Cargo, Meson, Cabal, Gradle, Maven, - DistInkt, Gem, Make, PerlBuildTiny, Golang, R] + DistInkt, Gem, Make, PerlBuildTiny, Golang, R, Octave] def scan_buildsystems(path):