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-04 10:13:04 +0100
commitc46a7e878ad94c856083fc84dbc09fc9f6126ff3 (patch)
treeaae0773b6169681fe86df5798bb2e1437642f46e
parentc74bfbe502bf85fbd1dfd493101b77ffef275ebe (diff)
downloadbuildstream-c46a7e878ad94c856083fc84dbc09fc9f6126ff3.tar.gz
setup.py: Change bwrap assertion to a warning
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. This should fix #644 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'
]