Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sundry fixes around meson setup handling #301

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,18 +754,18 @@ 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
dnicolodi marked this conversation as resolved.
Show resolved Hide resolved
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. Meson
# uses the presence of the 'meson-private/coredata.dat' file
# in the build directory as indication that the build
# directory has already been configured and arranges this file
# to be created as late as possible or deleted if something
# goes wrong during setup.
reconfigure = self._build_dir.joinpath('meson-private/coredata.dat').is_file()
FFY00 marked this conversation as resolved.
Show resolved Hide resolved

# run meson setup
self._configure(reconfigure=reconfigure)

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