aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/ci
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-29 00:02:48 +0000
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-29 00:02:48 +0000
commit95c97750137e4a9af144ac8531aed392501d7095 (patch)
tree6c3019e104fb323e7a5293da63dc5c4ac49960f7 /project/ci
parentproject.boost: factor out everything else (diff)
downloadcmake-common-95c97750137e4a9af144ac8531aed392501d7095.tar.gz
cmake-common-95c97750137e4a9af144ac8531aed392501d7095.zip
project.cmake: factor out common utils
Diffstat (limited to '')
-rw-r--r--project/ci/appveyor/cmake.py17
-rw-r--r--project/ci/travis/cmake.py17
2 files changed, 6 insertions, 28 deletions
diff --git a/project/ci/appveyor/cmake.py b/project/ci/appveyor/cmake.py
index e1ebce0..66e89f0 100644
--- a/project/ci/appveyor/cmake.py
+++ b/project/ci/appveyor/cmake.py
@@ -1,11 +1,9 @@
-#!/usr/bin/env python3
-
# Copyright (c) 2019 Egor Tensin <Egor.Tensin@gmail.com>
# This file is part of the "cmake-common" project.
# For details, see https://github.com/egor-tensin/cmake-common.
# Distributed under the MIT License.
-'''Build a CMake project on AppVeyor.
+R'''Build a CMake project on AppVeyor.
This is similar to build.py, but auto-fills some parameters for build.py from
the AppVeyor-defined environment variables.
@@ -20,6 +18,7 @@ import os
import sys
from project.cmake.build import build
+import project.utils
class Image(Enum):
@@ -108,12 +107,6 @@ def _get_configuration():
return _env('CONFIGURATION')
-def _setup_logging():
- logging.basicConfig(
- format='%(asctime)s | %(levelname)s | %(message)s',
- level=logging.INFO)
-
-
def _parse_args(argv=None):
if argv is None:
argv = sys.argv[1:]
@@ -152,12 +145,8 @@ def build_appveyor(argv=None):
def main(argv=None):
- _setup_logging()
- try:
+ with project.utils.setup_logging():
build_appveyor(argv)
- except Exception as e:
- logging.exception(e)
- raise
if __name__ == '__main__':
diff --git a/project/ci/travis/cmake.py b/project/ci/travis/cmake.py
index 7a1f707..cb96941 100644
--- a/project/ci/travis/cmake.py
+++ b/project/ci/travis/cmake.py
@@ -1,11 +1,9 @@
-#!/usr/bin/env python3
-
# Copyright (c) 2019 Egor Tensin <Egor.Tensin@gmail.com>
# This file is part of the "cmake-common" project.
# For details, see https://github.com/egor-tensin/cmake-common.
# Distributed under the MIT License.
-'''Build a CMake project on Travis.
+R'''Build a CMake project on Travis.
This is similar to build.py, but auto-fills some parameters for build.py from
the Travis-defined environment variables.
@@ -20,6 +18,7 @@ import os.path
import sys
from project.cmake.build import build
+import project.utils
def _env(name):
@@ -45,12 +44,6 @@ def _get_configuration():
return _env('configuration')
-def _setup_logging():
- logging.basicConfig(
- format='%(asctime)s | %(levelname)s | %(message)s',
- level=logging.INFO)
-
-
def _parse_args(argv=None):
if argv is None:
argv = sys.argv[1:]
@@ -87,12 +80,8 @@ def build_travis(argv=None):
def main(argv=None):
- _setup_logging()
- try:
+ with project.utils.setup_logging():
build_travis(argv)
- except Exception as e:
- logging.exception(e)
- raise
if __name__ == '__main__':