Skip to content

Commit 0cd2039

Browse files
dnicolodiFFY00
authored andcommitted
ENH: apply modified configuration options between rebuilds
Always pass the '--reconfigure' argument to 'meson setup' if the build directory is a valid Meson build directory. Fixes #300.
1 parent 330bf74 commit 0cd2039

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

mesonpy/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -754,18 +754,18 @@ def __init__( # noqa: C901
754754
[binaries]
755755
python = '{sys.executable}'
756756
''')
757-
native_file_mismatch = (
758-
not self._meson_native_file.exists()
759-
or self._meson_native_file.read_text() != native_file_data
760-
)
761-
if native_file_mismatch:
762-
self._meson_native_file.write_text(native_file_data)
763-
764-
# Don't reconfigure if build directory doesn't have meson-private/coredata.data
765-
# (means something went wrong)
766-
# See https://github.com/mesonbuild/meson-python/pull/257#discussion_r1067385517
767-
has_valid_build_dir = self._build_dir.joinpath('meson-private', 'coredata.dat').is_file()
768-
self._configure(reconfigure=has_valid_build_dir and not native_file_mismatch)
757+
self._meson_native_file.write_text(native_file_data)
758+
759+
# reconfigure if we have a valid Meson build directory. Meson
760+
# uses the presence of the 'meson-private/coredata.dat' file
761+
# in the build directory as indication that the build
762+
# directory has already been configured and arranges this file
763+
# to be created as late as possible or deleted if something
764+
# goes wrong during setup.
765+
reconfigure = self._build_dir.joinpath('meson-private/coredata.dat').is_file()
766+
767+
# run meson setup
768+
self._configure(reconfigure=reconfigure)
769769

770770
# set version if dynamic (this fetches it from Meson)
771771
if self._metadata and 'version' in self._metadata.dynamic:

0 commit comments

Comments
 (0)