Debian Codegraph @

unittests/__init__.py

raw
1 import os
2
3 import mesonbuild.compilers
4 from mesonbuild.mesonlib import setup_vsenv
5
6 def unset_envs():
7 # For unit tests we must fully control all command lines
8 # so that there are no unexpected changes coming from the
9 # environment, for example when doing a package build.
10 varnames = ['CPPFLAGS', 'LDFLAGS'] + list(mesonbuild.compilers.compilers.CFLAGS_MAPPING.values())
11 for v in varnames:
12 if v in os.environ:
13 del os.environ[v]
14
15 def set_envs():
16 os.environ.setdefault('MESON_UNIT_TEST_BACKEND', 'ninja')
17
18 setup_vsenv()
19 unset_envs()
20 set_envs()