summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-05-10 20:52:24 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-05-11 18:56:26 +0900
commit10929a5ccda9f82c2bd16a172a17eed0bc33c1b5 (patch)
tree663a77f185ce7f8eb8ae5c2a10174f788d919047
parentc08e1b2d4a2d0d4f43a4549585d393645ed5c552 (diff)
downloadbuildstream-tristan/revert-bwrap-checks.tar.gz
Revert "_site.py: Add check_bwrap_version() function"tristan/revert-bwrap-checks
This reverts commit 03823d124f61c18346dd2d8282055ab25d6f9aa6. For some reason, the changes introduced here cause issue #395 to occur, without these changes we are not hitting the spurrious errors described in #395.
-rw-r--r--buildstream/_site.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/buildstream/_site.py b/buildstream/_site.py
index f4780ef3d..622839511 100644
--- a/buildstream/_site.py
+++ b/buildstream/_site.py
@@ -19,8 +19,6 @@
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
import os
-import shutil
-import subprocess
#
# Private module declaring some info about where the buildstream
@@ -47,50 +45,3 @@ build_all_template = os.path.join(root, 'data', 'build-all.sh.in')
# Module building script template
build_module_template = os.path.join(root, 'data', 'build-module.sh.in')
-
-# Cached bwrap version
-_bwrap_major = None
-_bwrap_minor = None
-_bwrap_patch = None
-
-
-# check_bwrap_version()
-#
-# Checks the version of installed bwrap against the requested version
-#
-# Args:
-# major (int): The required major version
-# minor (int): The required minor version
-# patch (int): The required patch level
-#
-# Returns:
-# (bool): Whether installed bwrap meets the requirements
-#
-def check_bwrap_version(major, minor, patch):
- # pylint: disable=global-statement
-
- global _bwrap_major
- global _bwrap_minor
- global _bwrap_patch
-
- # Parse bwrap version and save into cache, if not already cached
- if _bwrap_major is None:
- bwrap_path = shutil.which('bwrap')
- if not bwrap_path:
- return False
- cmd = [bwrap_path, "--version"]
- version = str(subprocess.check_output(cmd).split()[1], "utf-8")
- _bwrap_major, _bwrap_minor, _bwrap_patch = map(int, version.split("."))
-
- # Check whether the installed version meets the requirements
- if _bwrap_major > major:
- return True
- elif _bwrap_major < major:
- return False
- else:
- if _bwrap_minor > minor:
- return True
- elif _bwrap_minor < minor:
- return False
- else:
- return _bwrap_patch >= patch