Skip to content

Commit

Permalink
ENH: apply modified configuration options between rebuilds
Browse files Browse the repository at this point in the history
Always pass the '--reconfigure' argument to 'meson setup' if the build
directory is a valid Meson build directory.

Fixes #300.
  • Loading branch information
dnicolodi committed Feb 8, 2023
1 parent a1fef99 commit 078932f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,18 +764,11 @@ def __init__( # noqa: C901
[binaries]
python = '{sys.executable}'
''')
native_file_mismatch = (
not self._meson_native_file.exists()
or self._meson_native_file.read_text() != native_file_data
)
if native_file_mismatch:
self._meson_native_file.write_text(native_file_data)

# Don't reconfigure if build directory doesn't have meson-private/coredata.data
# (means something went wrong)
# See https://github.com/mesonbuild/meson-python/pull/257#discussion_r1067385517
has_valid_build_dir = self._build_dir.joinpath('meson-private', 'coredata.dat').is_file()
self._configure(reconfigure=has_valid_build_dir and not native_file_mismatch)
self._meson_native_file.write_text(native_file_data)

# reconfigure if we have a valid Meson build directory
has_valid_build_dir = self._build_dir.joinpath('meson-private/coredata.dat').is_file()
self._configure(reconfigure=has_valid_build_dir)

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

0 comments on commit 078932f

Please sign in to comment.