Skip to content

Commit

Permalink
Prevent changing backend during reconfigure.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Mar 23, 2023
1 parent b85ffba commit 0530c46
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mesonbuild/mesonmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,20 @@ def set_meson_command(mainfile):
from . import mesonlib
mesonlib.set_meson_command(mainfile)

def prevent_backend_change(args):
has_reconf = False
has_backend = False
for arg in args:
if arg.startswith('--reconfigure'):
has_reconf = True
if arg.startswith('--backend'):
has_backend = True
if has_reconf and has_backend:
sys.exit('''Setting the backend during reconfiguration is not supported.
If you want to change the backend, you must create a new build directory.''')

def run(original_args, mainfile):
prevent_backend_change(original_args)
if os.environ.get('MESON_SHOW_DEPRECATIONS'):
# workaround for https://bugs.python.org/issue34624
import warnings
Expand Down

0 comments on commit 0530c46

Please sign in to comment.