Debian Codegraph @

meson.py

raw
1 #!/usr/bin/env python3
2 # SPDX-License-Identifier: Apache-2.0
3 # Copyright 2016 The Meson development team
4 # Copyright © 2023 Intel Corporation
5
6 import sys
7
8 # Check python version before importing anything else, we might have an older
9 # Python that would error on f-string syntax for example.
10 if sys.version_info < (3, 10):
11 print('Meson works correctly only with python 3.10+.')
12 print('You have python {}.'.format(sys.version))
13 print('Please update your environment')
14 sys.exit(1)
15
16 from pathlib import Path
17
18 # If we're run uninstalled, add the script directory to sys.path to ensure that
19 # we always import the correct mesonbuild modules even if PYTHONPATH is mangled
20 meson_exe = Path(sys.argv[0]).resolve()
21 if (meson_exe.parent / 'mesonbuild').is_dir():
22 sys.path.insert(0, str(meson_exe.parent))
23
24 from mesonbuild import mesonmain
25
26 if __name__ == '__main__':
27 sys.exit(mesonmain.main())