Add scan_buildsystems.
This commit is contained in:
parent
a3f7f8ba21
commit
57746c8352
1 changed files with 7 additions and 6 deletions
|
@ -1009,29 +1009,30 @@ BUILDSYSTEM_CLSES = [
|
||||||
DistInkt, Gem, Make, PerlBuildTiny, Golang, R]
|
DistInkt, Gem, Make, PerlBuildTiny, Golang, R]
|
||||||
|
|
||||||
|
|
||||||
def detect_buildsystems(path, trust_package=False):
|
def scan_buildsystems(path):
|
||||||
"""Detect build systems."""
|
"""Detect build systems."""
|
||||||
ret = []
|
ret = []
|
||||||
ret.extend(_detect_buildsystems_directory(path))
|
ret.extend([('.', bs) for bs in detect_buildsystems(path)])
|
||||||
|
|
||||||
if not ret:
|
if not ret:
|
||||||
# Nothing found. Try the next level?
|
# Nothing found. Try the next level?
|
||||||
for entry in os.scandir(path):
|
for entry in os.scandir(path):
|
||||||
if entry.is_dir():
|
if entry.is_dir():
|
||||||
ret.extend(_detect_buildsystems_directory(entry.path))
|
ret.extend(
|
||||||
|
[(entry.name, bs) for bs in detect_buildsystems(entry.path)])
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def _detect_buildsystems_directory(path):
|
def detect_buildsystems(path):
|
||||||
for bs_cls in BUILDSYSTEM_CLSES:
|
for bs_cls in BUILDSYSTEM_CLSES:
|
||||||
bs = bs_cls.probe(path)
|
bs = bs_cls.probe(path)
|
||||||
if bs is not None:
|
if bs is not None:
|
||||||
yield bs
|
yield bs
|
||||||
|
|
||||||
|
|
||||||
def get_buildsystem(path, trust_package=False):
|
def get_buildsystem(path):
|
||||||
for buildsystem in detect_buildsystems(path, trust_package=trust_package):
|
for buildsystem in detect_buildsystems(path):
|
||||||
return buildsystem
|
return buildsystem
|
||||||
|
|
||||||
raise NoBuildToolsFound()
|
raise NoBuildToolsFound()
|
||||||
|
|
Loading…
Add table
Reference in a new issue