Skip to content

Commit c8dbaee

Browse files
dnicolodiFFY00
authored andcommitted
ENH: place native and cross files in the build directory
Use a 'meson-python-' prefix to likely avoid any possible name collision. As the build directory is supposed to contain build artefact there is no advantage in using an UNIX hidden file name for these files, and this makes them a little bit more discoverable. Fixes #299.
1 parent 9670e29 commit c8dbaee

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

mesonpy/__init__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@ def __init__( # noqa: C901
679679
self._build_dir = pathlib.Path(build_dir).absolute() if build_dir else (self._working_dir / 'build')
680680
self._editable_verbose = editable_verbose
681681
self._install_dir = self._working_dir / 'install'
682-
self._meson_native_file = self._source_dir / '.mesonpy-native-file.ini'
683-
self._meson_cross_file = self._source_dir / '.mesonpy-cross-file.ini'
682+
self._meson_native_file = self._build_dir / 'meson-python-native-file.ini'
683+
self._meson_cross_file = self._build_dir / 'meson-python-cross-file.ini'
684684
self._meson_args: MesonArgs = collections.defaultdict(list)
685685
self._env = os.environ.copy()
686686

@@ -759,14 +759,7 @@ def __init__( # noqa: C901
759759
or self._meson_native_file.read_text() != native_file_data
760760
)
761761
if native_file_mismatch:
762-
try:
763-
self._meson_native_file.write_text(native_file_data)
764-
except OSError:
765-
# if there are permission errors or something else in the source
766-
# directory, put the native file in the working directory instead
767-
# (this won't survive multiple calls -- Meson will have to be reconfigured)
768-
self._meson_native_file = self._working_dir / '.mesonpy-native-file.ini'
769-
self._meson_native_file.write_text(native_file_data)
762+
self._meson_native_file.write_text(native_file_data)
770763

771764
# Don't reconfigure if build directory doesn't have meson-private/coredata.data
772765
# (means something went wrong)

0 commit comments

Comments
 (0)