mesonbuild/scripts/copy.py
raw| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # Copyright © 2021-2023 Intel Corporation |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | """Helper script to copy files at build time. |
| 6 | |
| 7 | This is easier than trying to detect whether to use copy, cp, or something else. |
| 8 | """ |
| 9 | |
| 10 | import shutil |
| 11 | import typing as T |
| 12 | |
| 13 | |
| 14 | def run(args: T.List[str]) -> int: |
| 15 | try: |
| 16 | shutil.copy2(args[0], args[1]) |
| 17 | except Exception: |
| 18 | return 1 |
| 19 | return 0 |