From 0fa3ad2c007d1ea90694f73754ccac8c42dcdf93 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Apr 2021 19:14:23 +0300 Subject: remove excessive logging & obsolete project.ci.* packages Logging command line arguments before parsing them is a bit excessive. --- project/boost/build.py | 4 ++-- project/boost/download.py | 4 ++-- project/ci/appveyor/boost.py | 17 --------------- project/ci/appveyor/cmake.py | 17 --------------- project/ci/boost.py | 35 +++++++++++++++-------------- project/ci/cmake.py | 51 +++++++++++++++++++++---------------------- project/ci/github/__init__.py | 0 project/ci/github/boost.py | 17 --------------- project/ci/github/cmake.py | 17 --------------- project/ci/travis/__init__.py | 0 project/ci/travis/boost.py | 17 --------------- project/ci/travis/cmake.py | 17 --------------- project/cmake/build.py | 4 ++-- 13 files changed, 48 insertions(+), 152 deletions(-) delete mode 100644 project/ci/appveyor/boost.py delete mode 100644 project/ci/appveyor/cmake.py delete mode 100644 project/ci/github/__init__.py delete mode 100644 project/ci/github/boost.py delete mode 100644 project/ci/github/cmake.py delete mode 100644 project/ci/travis/__init__.py delete mode 100644 project/ci/travis/boost.py delete mode 100644 project/ci/travis/cmake.py (limited to 'project') diff --git a/project/boost/build.py b/project/boost/build.py index 8cd41f5..9b44b2f 100644 --- a/project/boost/build.py +++ b/project/boost/build.py @@ -137,7 +137,6 @@ def build(params): def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] - logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser( description=__doc__, @@ -189,8 +188,9 @@ def _parse_args(argv=None): def _main(argv=None): + args = _parse_args(argv) with setup_logging(): - build(BuildParameters.from_cmd_args(_parse_args(argv))) + build(BuildParameters.from_cmd_args(args)) if __name__ == '__main__': diff --git a/project/boost/download.py b/project/boost/download.py index a065dab..f2ad21d 100644 --- a/project/boost/download.py +++ b/project/boost/download.py @@ -109,7 +109,6 @@ def download(params): def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] - logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser( description=__doc__, @@ -132,8 +131,9 @@ def _parse_args(argv=None): def _main(argv=None): + args = _parse_args(argv) with setup_logging(): - download(DownloadParameters.from_args(_parse_args(argv))) + download(DownloadParameters.from_args(args)) if __name__ == '__main__': diff --git a/project/ci/appveyor/boost.py b/project/ci/appveyor/boost.py deleted file mode 100644 index 068fc26..0000000 --- a/project/ci/appveyor/boost.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2020 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.boost import build_ci -from project.ci.dirs import AppVeyor -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(AppVeyor(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/ci/appveyor/cmake.py b/project/ci/appveyor/cmake.py deleted file mode 100644 index 6df28f2..0000000 --- a/project/ci/appveyor/cmake.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2019 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.cmake import build_ci -from project.ci.dirs import AppVeyor -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(AppVeyor(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/ci/boost.py b/project/ci/boost.py index 588df92..1b47710 100644 --- a/project/ci/boost.py +++ b/project/ci/boost.py @@ -17,7 +17,6 @@ from project.utils import setup_logging def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] - logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser( description=Dirs.get_boost_help(), @@ -39,28 +38,28 @@ def _parse_args(argv=None): def build_ci(dirs, argv=None): args = _parse_args(argv) - if dirs is None: - dirs = Dirs.detect() + with setup_logging(): + if dirs is None: + dirs = Dirs.detect() - version = dirs.get_boost_version() - build_dir = dirs.get_build_dir() - boost_dir = dirs.get_boost_dir() - params = DownloadParameters(version, cache_dir=build_dir, dest_path=boost_dir) - download(params) + version = dirs.get_boost_version() + build_dir = dirs.get_build_dir() + boost_dir = dirs.get_boost_dir() + params = DownloadParameters(version, cache_dir=build_dir, dest_path=boost_dir) + download(params) - params = BuildParameters(boost_dir, - platforms=(dirs.get_platform(),), - configurations=(dirs.get_configuration(),), - link=args.link, - runtime_link=args.runtime_link, - toolset=dirs.get_toolset(), - b2_args=args.b2_args) - build(params) + params = BuildParameters(boost_dir, + platforms=(dirs.get_platform(),), + configurations=(dirs.get_configuration(),), + link=args.link, + runtime_link=args.runtime_link, + toolset=dirs.get_toolset(), + b2_args=args.b2_args) + build(params) def main(argv=None): - with setup_logging(): - build_ci(None, argv) + build_ci(None, argv) if __name__ == '__main__': diff --git a/project/ci/cmake.py b/project/ci/cmake.py index 70fd885..83a80e8 100644 --- a/project/ci/cmake.py +++ b/project/ci/cmake.py @@ -16,7 +16,6 @@ from project.utils import setup_logging def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] - logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser( description=Dirs.get_cmake_help(), @@ -35,37 +34,37 @@ def _parse_args(argv=None): def build_ci(dirs, argv=None): args = _parse_args(argv) - if dirs is None: - dirs = Dirs.detect() + with setup_logging(): + if dirs is None: + dirs = Dirs.detect() - src_dir = dirs.get_src_dir() - if args.subdir: - src_dir = os.path.join(src_dir, args.subdir) - install_dir = dirs.get_install_dir() if args.install else None + src_dir = dirs.get_src_dir() + if args.subdir: + src_dir = os.path.join(src_dir, args.subdir) + install_dir = dirs.get_install_dir() if args.install else None - boost_dir = args.boost_dir - if not boost_dir: - # If we've built Boost using project.ci.boost already, use that. - # Otherwise, try to use the latest pre-built Boost provided by the CI - # system. - boost_dir = dirs.get_boost_dir() - if not os.path.isdir(boost_dir): - boost_dir = dirs.get_prebuilt_boost_dir() + boost_dir = args.boost_dir + if not boost_dir: + # If we've built Boost using project.ci.boost already, use that. + # Otherwise, try to use the latest pre-built Boost provided by the CI + # system. + boost_dir = dirs.get_boost_dir() + if not os.path.isdir(boost_dir): + boost_dir = dirs.get_prebuilt_boost_dir() - params = BuildParameters(src_dir, - build_dir=dirs.get_cmake_dir(), - install_dir=install_dir, - platform=dirs.get_platform(), - configuration=dirs.get_configuration(), - boost_dir=boost_dir, - toolset=dirs.get_toolset(), - cmake_args=dirs.get_cmake_args() + args.cmake_args) - build(params) + params = BuildParameters(src_dir, + build_dir=dirs.get_cmake_dir(), + install_dir=install_dir, + platform=dirs.get_platform(), + configuration=dirs.get_configuration(), + boost_dir=boost_dir, + toolset=dirs.get_toolset(), + cmake_args=dirs.get_cmake_args() + args.cmake_args) + build(params) def main(argv=None): - with setup_logging(): - build_ci(None, argv) + build_ci(None, argv) if __name__ == '__main__': diff --git a/project/ci/github/__init__.py b/project/ci/github/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/project/ci/github/boost.py b/project/ci/github/boost.py deleted file mode 100644 index 5fd1e48..0000000 --- a/project/ci/github/boost.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2019 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.boost import build_ci -from project.ci.dirs import GitHub -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(GitHub(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/ci/github/cmake.py b/project/ci/github/cmake.py deleted file mode 100644 index 9b9c7b9..0000000 --- a/project/ci/github/cmake.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2019 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.cmake import build_ci -from project.ci.dirs import GitHub -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(GitHub(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/ci/travis/__init__.py b/project/ci/travis/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/project/ci/travis/boost.py b/project/ci/travis/boost.py deleted file mode 100644 index 7aff33e..0000000 --- a/project/ci/travis/boost.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2019 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.boost import build_ci -from project.ci.dirs import Travis -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(Travis(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/ci/travis/cmake.py b/project/ci/travis/cmake.py deleted file mode 100644 index 2f030af..0000000 --- a/project/ci/travis/cmake.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2019 Egor Tensin -# This file is part of the "cmake-common" project. -# For details, see https://github.com/egor-tensin/cmake-common. -# Distributed under the MIT License. - -from project.ci.cmake import build_ci -from project.ci.dirs import Travis -from project.utils import setup_logging - - -def main(argv=None): - with setup_logging(): - build_ci(Travis(), argv) - - -if __name__ == '__main__': - main() diff --git a/project/cmake/build.py b/project/cmake/build.py index cb2e4cb..74cafa6 100644 --- a/project/cmake/build.py +++ b/project/cmake/build.py @@ -197,7 +197,6 @@ def build(params): def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] - logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser( description=__doc__, @@ -240,8 +239,9 @@ def _parse_args(argv=None): def main(argv=None): + args = _parse_args(argv) with setup_logging(): - build(BuildParameters.from_args(_parse_args(argv))) + build(BuildParameters.from_args(args)) if __name__ == '__main__': -- cgit v1.2.3