aboutsummaryrefslogtreecommitdiff
path: root/tools/run_with_cov.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run_with_cov.py')
-rwxr-xr-xtools/run_with_cov.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/tools/run_with_cov.py b/tools/run_with_cov.py
deleted file mode 100755
index 0d3fba6..0000000
--- a/tools/run_with_cov.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python3
-# SPDX-License-Identifier: Apache-2.0
-# Copyright 2021 The Meson development team
-
-import subprocess
-import coverage
-import os
-import sys
-from pathlib import Path
-
-root_path = Path(__file__).parent.parent.absolute()
-
-# Python magic so we can import mesonlib
-sys.path.append(root_path.as_posix())
-from mesonbuild import mesonlib
-
-def generate_coveragerc() -> Path:
- i_file = (root_path / 'data' / '.coveragerc.in')
- o_file = (root_path / '.coveragerc')
- raw = i_file.read_text(encoding='utf-8')
- raw = raw.replace('@ROOT@', root_path.as_posix())
- o_file.write_text(raw, encoding='utf-8')
- return o_file
-
-def main() -> int:
- # Remove old run data
- out_dir = root_path / '.coverage'
- mesonlib.windows_proof_rmtree(out_dir.as_posix())
- out_dir.mkdir(parents=True, exist_ok=True)
-
- # Setup coverage
- python_path = (root_path / 'ci').as_posix()
- os.environ['PYTHONPATH'] = os.pathsep.join([python_path, os.environ.get('PYTHONPATH', '')])
- os.environ['COVERAGE_PROCESS_START'] = generate_coveragerc().as_posix()
- coverage.process_startup()
-
- # Run the actual command
- cmd = mesonlib.python_command + sys.argv[1:]
- return subprocess.run(cmd, env=os.environ.copy()).returncode
-
-if __name__ == '__main__':
- raise SystemExit(main())