From e3c81aeff2eae97259df94bc066296432a95ef22 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 15 Dec 2019 13:12:46 +0300 Subject: ci: minor script enhancements --- ci/boost/build.py | 3 +++ ci/boost/build_travis.py | 14 ++++++++++++-- ci/build_appveyor.py | 2 +- ci/build_travis.py | 21 +++++++++++++++++++-- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ci/boost/build.py b/ci/boost/build.py index fed6b81..63f8e0f 100755 --- a/ci/boost/build.py +++ b/ci/boost/build.py @@ -6,6 +6,9 @@ # Distributed under the MIT License. # This script downloads and builds the Boost libraries. +# It's main utility is being able to download & unpack the Boost distribution +# archive in a cross-platform way + setting the correct --stagedir parameter +# value to avoid name clashes. import argparse from contextlib import contextmanager diff --git a/ci/boost/build_travis.py b/ci/boost/build_travis.py index de8c957..ec38f7c 100755 --- a/ci/boost/build_travis.py +++ b/ci/boost/build_travis.py @@ -9,6 +9,7 @@ # the Travis-defined environment variables. # Boost is built in $HOME. +import argparse import logging import os import sys @@ -49,10 +50,19 @@ def _setup_logging(): level=logging.INFO) -def build_travis(argv=None): +def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] logging.info('Command line arguments: %s', argv) + + parser = argparse.ArgumentParser() + parser.add_argument('b2_args', nargs='*', metavar='B2_ARG', default=(), + help='additional b2 arguments, to be passed verbatim') + return parser.parse_args(argv) + + +def build_travis(argv=None): + args = _parse_args(argv) _check_travis() version = BoostVersion.from_string(_get_boost_version()) @@ -69,7 +79,7 @@ def build_travis(argv=None): '--platform', _get_platform(), '--', version.dir_path(_get_build_dir()), ] - build_main(travis_argv + argv) + build_main(travis_argv + args.b2_args) def main(argv=None): diff --git a/ci/build_appveyor.py b/ci/build_appveyor.py index 56b4d4b..66c2e31 100755 --- a/ci/build_appveyor.py +++ b/ci/build_appveyor.py @@ -118,7 +118,7 @@ def _parse_args(argv=None): parser = argparse.ArgumentParser(description='Build a CMake project on AppVeyor') parser.add_argument('--install', metavar='DIR', dest='install_dir', help='install directory') - parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', + parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', default=(), help='additional CMake arguments, to be passed verbatim') return parser.parse_args(argv) diff --git a/ci/build_travis.py b/ci/build_travis.py index 564f964..4b3a3eb 100755 --- a/ci/build_travis.py +++ b/ci/build_travis.py @@ -9,6 +9,7 @@ # the Travis-defined environment variables. # The project is built in $HOME/build. +import argparse import logging import os import os.path @@ -46,10 +47,21 @@ def _setup_logging(): level=logging.INFO) -def build_travis(argv=None): +def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] logging.info('Command line arguments: %s', argv) + + parser = argparse.ArgumentParser(description='Build a CMake project on Travis') + parser.add_argument('--install', metavar='DIR', dest='install_dir', + help='install directory') + parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', default=(), + help='additional CMake arguments, to be passed verbatim') + return parser.parse_args(argv) + + +def build_travis(argv=None): + args = _parse_args(argv) _check_travis() travis_argv = [ @@ -57,7 +69,12 @@ def build_travis(argv=None): '--build', _get_build_dir(), '--configuration', _get_configuration(), ] - build(travis_argv + argv) + if args.install_dir is not None: + travis_argv += [ + '--install', args.install_dir, + ] + travis_argv.append('--') + build(travis_argv + args.cmake_args) def main(argv=None): -- cgit v1.2.3