summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-02 13:39:15 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-03 17:03:00 +0100
commita53aa45c88b80cb1393121ffcb247e80405214e4 (patch)
tree58140550cf78743bb74072508e6461eef8157f7c
parent13e70232f8139510db4f51a91a396a8a32579291 (diff)
downloadbuildstream-danielsilverstone-ct/bwrap-check-runtime-only.tar.gz
setup.py: Change bwrap assertion to a warningdanielsilverstone-ct/bwrap-check-runtime-only
Since there are use-cases where BuildStream could be installed onto systems which do not have BubbleWrap (e.g. for remote-build-only scenarios) it is not correct to assert a dependency on bwrap during installation. This patch makes the assertion a warning, and also clarifies the message somewhat. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rwxr-xr-xsetup.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/setup.py b/setup.py
index 405a39061..74ccfc24a 100755
--- a/setup.py
+++ b/setup.py
@@ -54,12 +54,13 @@ REQUIRED_BWRAP_MINOR = 1
REQUIRED_BWRAP_PATCH = 2
-def exit_bwrap(reason):
+def warn_bwrap(reason):
print(reason +
- "\nBuildStream requires Bubblewrap (bwrap) for"
- " sandboxing the build environment. Install it using your package manager"
- " (usually bwrap or bubblewrap)")
- sys.exit(1)
+ "\nBuildStream requires Bubblewrap (bwrap {}.{}.{} or better),"
+ " during local builds, for"
+ " sandboxing the build environment.\nInstall it using your package manager"
+ " (usually bwrap or bubblewrap) otherwise you will be limited to"
+ " remote builds only.".format(REQUIRED_BWRAP_MAJOR, REQUIRED_BWRAP_MINOR, REQUIRED_BWRAP_PATCH))
def bwrap_too_old(major, minor, patch):
@@ -76,18 +77,19 @@ def bwrap_too_old(major, minor, patch):
return False
-def assert_bwrap():
+def check_for_bwrap():
platform = os.environ.get('BST_FORCE_BACKEND', '') or sys.platform
if platform.startswith('linux'):
bwrap_path = shutil.which('bwrap')
if not bwrap_path:
- exit_bwrap("Bubblewrap not found")
+ warn_bwrap("Bubblewrap not found")
+ return
version_bytes = subprocess.check_output([bwrap_path, "--version"]).split()[1]
version_string = str(version_bytes, "utf-8")
major, minor, patch = map(int, version_string.split("."))
if bwrap_too_old(major, minor, patch):
- exit_bwrap("Bubblewrap too old")
+ warn_bwrap("Bubblewrap too old")
###########################################
@@ -126,7 +128,7 @@ bst_install_entry_points = {
}
if not os.environ.get('BST_ARTIFACTS_ONLY', ''):
- assert_bwrap()
+ check_for_bwrap()
bst_install_entry_points['console_scripts'] += [
'bst = buildstream._frontend:cli'
]