From c033cfee92dc42d7beb05747c63c93016b42c052 Mon Sep 17 00:00:00 2001 From: William Tambellini Date: Thu, 20 Feb 2020 23:26:25 -0800 Subject: [PATCH] Check python version (#356) Check python version in build.py --- tools/ci_build/build.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 611f646b6b..75cbedb470 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -35,6 +35,16 @@ class UsageError(BaseError): def __init__(self, message): super().__init__(message) +def checkPythonVersion(): + # According to the BUILD.md, python 3.5+ is required: + # Python 2 is definitely not supported and it should be safer to consider it wont run with python 4: + if sys.version_info[0] != 3 : + raise BuildError("Bad python major version: expecting python 3, found version '{}'".format(sys.version)) + if sys.version_info[1] < 5 : + raise BuildError("Bad python minor version: expecting python 3.5+, found version '{}'".format(sys.version)) + +checkPythonVersion() + def parse_arguments(): parser = argparse.ArgumentParser(description="ONNXRuntime CI build driver.", usage='''