You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:47:04 UTC
[buildstream] 02/17: Revert "_site.py: Add check_bwrap_version()
function"
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch jmac/virtual_directories_test
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c5d1a5a2b960ac8edf8a55fc009c3ed58204c11f
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu May 10 20:52:24 2018 +0900
Revert "_site.py: Add check_bwrap_version() function"
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.
---
buildstream/_site.py | 49 -------------------------------------------------
1 file changed, 49 deletions(-)
diff --git a/buildstream/_site.py b/buildstream/_site.py
index f4780ef..6228395 100644
--- a/buildstream/_site.py
+++ b/buildstream/_site.py
@@ -19,8 +19,6 @@
# Tristan Van Berkom <tr...@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