mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Detect missing builder early
This commit is contained in:
parent
b4a6cf5310
commit
6e05bb7e74
@ -19,6 +19,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
|
|
||||||
from devscripts.logger import Logger
|
from devscripts.logger import Logger
|
||||||
from ubuntutools import subprocess
|
from ubuntutools import subprocess
|
||||||
@ -41,6 +42,12 @@ class Builder(object):
|
|||||||
(os.path.basename(dsc_file), self.name))
|
(os.path.basename(dsc_file), self.name))
|
||||||
return returncode
|
return returncode
|
||||||
|
|
||||||
|
def exists_in_path(self):
|
||||||
|
for path in os.environ.get('PATH', os.defpath).split(os.pathsep):
|
||||||
|
if os.path.isfile(os.path.join(path, self.name)):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def get_architecture(self):
|
def get_architecture(self):
|
||||||
return self.architecture
|
return self.architecture
|
||||||
|
|
||||||
@ -155,7 +162,10 @@ _SUPPORTED_BUILDERS = {
|
|||||||
|
|
||||||
def get_builder(builder):
|
def get_builder(builder):
|
||||||
if builder in _SUPPORTED_BUILDERS:
|
if builder in _SUPPORTED_BUILDERS:
|
||||||
return _SUPPORTED_BUILDERS[builder]()
|
b = _SUPPORTED_BUILDERS[builder]()
|
||||||
|
if b.exists_in_path():
|
||||||
|
return b
|
||||||
|
Logger.error("Builder doesn't appear to be installed: %s", builder)
|
||||||
else:
|
else:
|
||||||
Logger.error("Unsupported builder specified: %s.", builder)
|
Logger.error("Unsupported builder specified: %s.", builder)
|
||||||
Logger.error("Supported builders: %s",
|
Logger.error("Supported builders: %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user