-
Notifications
You must be signed in to change notification settings - Fork 81
Better error message for install_subdir with inexisting directory #675
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
Conversation
|
|
||
| if key == 'install_subdirs' or key == 'targets' and os.path.isdir(src): | ||
| assert os.path.isdir(src) | ||
| assert os.path.isdir(src), f'Directory {src} does not exist' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is incorrect: isdir() checks that the path is a directory, not only that it exists. Anyhow, the code was written like this in the assumption that meson checks at setup time that the source directory exists. Is this not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you are correct, in my case it didn't exist, and I forgot it could also not be a directory.
I'm running meson build and in meson.build I had a install_subdir('typo_in_the_name', install_dir: py.get_install_dir()), and I got the empty AssertionError.
The full execution is:
$ uv run meson build
error: Failed to prepare distributions
Caused by: Failed to fetch wheel: sklearnt @ file:///home/mgarcia/src/trees/sklearnt
Caused by: Build backend failed to build editable through `build_editable()` with exit status: 1
--- stdout:
+ meson setup --reconfigure /home/mgarcia/src/trees/sklearnt /home/mgarcia/src/trees/sklearnt/build/cp312 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/home/mgarcia/src/trees/sklearnt/build/cp312/meson-python-native-file.ini
Cleaning... 0 files.
The Meson build system
Version: 1.5.2
Source dir: /home/mgarcia/src/trees/sklearnt
Build dir: /home/mgarcia/src/trees/sklearnt/build/cp312
Build type: native build
Project name: sklearnt
Project version: 1.0
C compiler for the host machine: cc (gcc 14.2.1 "cc (GCC) 14.2.1 20240910")
C linker for the host machine: cc ld.bfd 2.43.0
C++ compiler for the host machine: c++ (gcc 14.2.1 "c++ (GCC) 14.2.1 20240910")
C++ linker for the host machine: c++ ld.bfd 2.43.0
Cython compiler for the host machine: cython (cython 3.0.11)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wno-unused-but-set-variable: YES (cached)
Compiler for C supports arguments -Wno-unused-function: YES (cached)
Compiler for C supports arguments -Wno-conversion: YES (cached)
Compiler for C supports arguments -Wno-misleading-indentation: YES (cached)
Library m found: YES
Program python found: YES (/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/bin/python)
../../meson.build:40: WARNING: Project targets '>= 1.1.0' but uses feature deprecated since '0.60.0': install_subdir with empty directory. It worked by accident and is buggy. Use install_emptydir instead.
Dependency OpenMP found: YES 4.5 (cached)
Found pkg-config: YES (/usr/bin/pkg-config) 2.1.1
Run-time dependency python found: YES 3.12
Build targets in project: 5
WARNING: Deprecated features used:
* 0.60.0: {'install_subdir with empty directory'}
sklearnt 1.0
User defined options
Native files: /home/mgarcia/src/trees/sklearnt/build/cp312/meson-python-native-file.ini
buildtype : release
b_ndebug : if-release
b_vscrt : md
Found ninja-1.12.1 at /usr/bin/ninja
+ /usr/bin/ninja
[1/14] Compiling C object sklearnt/_utils.cpython-312-x86_64-linux-gnu.so.p/meson-generated_sklearnt__utils.pyx.c.o
[2/14] Linking target sklearnt/_utils.cpython-312-x86_64-linux-gnu.so
[3/14] Compiling Cython source /home/mgarcia/src/trees/sklearnt/sklearnt/_splitter.pyx
[4/14] Compiling Cython source /home/mgarcia/src/trees/sklearnt/sklearnt/_criterion.pyx
[5/14] Compiling Cython source /home/mgarcia/src/trees/sklearnt/sklearnt/_partitioner.pyx
[6/14] Compiling Cython source /home/mgarcia/src/trees/sklearnt/sklearnt/_tree.pyx
[7/14] Compiling C object sklearnt/_partitioner.cpython-312-x86_64-linux-gnu.so.p/meson-generated_sklearnt__partitioner.pyx.c.o
[8/14] Linking target sklearnt/_partitioner.cpython-312-x86_64-linux-gnu.so
[9/14] Compiling C object sklearnt/_splitter.cpython-312-x86_64-linux-gnu.so.p/meson-generated_sklearnt__splitter.pyx.c.o
[10/14] Linking target sklearnt/_splitter.cpython-312-x86_64-linux-gnu.so
[11/14] Compiling C object sklearnt/_criterion.cpython-312-x86_64-linux-gnu.so.p/meson-generated_sklearnt__criterion.pyx.c.o
[12/14] Linking target sklearnt/_criterion.cpython-312-x86_64-linux-gnu.so
[13/14] Compiling C++ object sklearnt/_tree.cpython-312-x86_64-linux-gnu.so.p/meson-generated_sklearnt__tree.pyx.cpp.o
[14/14] Linking target sklearnt/_tree.cpython-312-x86_64-linux-gnu.so
src /home/mgarcia/src/trees/sklearnt/sklearn
--- stderr:
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/lib/python3.12/site-packages/mesonpy/__init__.py", line 1021, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/lib/python3.12/site-packages/mesonpy/__init__.py", line 1097, in build_editable
return project.editable(out).name
^^^^^^^^^^^^^^^^^^^^^
File "/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/lib/python3.12/site-packages/mesonpy/__init__.py", line 931, in editable
builder = _EditableWheelBuilder(self._metadata, self._manifest, self._limited_api)
^^^^^^^^^^^^^^
File "/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/lib/python3.12/site-packages/mesonpy/__init__.py", line 845, in _manifest
return _map_to_wheel(sources)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/mgarcia/.cache/uv/builds-v0/.tmpYFsCqS/lib/python3.12/site-packages/mesonpy/__init__.py", line 124, in _map_to_wheel
assert os.path.isdir(src)
^^^^^^^^^^^^^^^^^^
AssertionError
---
Please let me know if this PR is useful and I'll update the message, otherwise feel free to close.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bug in Meson: the check for the non-existing directory is likely there, but it fails. I'll have a look. I don't think the error message belongs in meson-python, and if it does, it should not be an assertion error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a misfeature added in mesonbuild/meson#8292
This seems like an implementation detail but is quite useful to create new directories for e.g. configuration or plugins in the installed locations.
But it wasn't (useful), actually. :) We added install_emptydir and deprecated this. We cannot make it an error until meson 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I figured it out. See #676
|
Superseded by #676 |
Currently just
AssertionErroris shown. This will displayAssertionError: Directory /wrong/dir does not exist.