dependencies/python: better error when C compiler is missing - #16029
Open
mmustafasenoglu wants to merge 1 commit into
Open
dependencies/python: better error when C compiler is missing#16029mmustafasenoglu wants to merge 1 commit into
mmustafasenoglu wants to merge 1 commit into
Conversation
When python.dependency() is used in a project that does not have a C
compiler (e.g. project('foo', 'rust')), the PythonSystemDependency
falls back to MissingCompiler which raises a generic 'no toolchain
found' DependencyException. This is confusing for users who don't
realize that detecting the Python library requires a C compiler.
Add an early check in PythonSystemDependency.__init__ that detects
when clib_compiler is missing and raises a clear error message
explaining that a C compiler is needed and how to add one.
Also guard the has_header() call against MissingCompiler to avoid
AttributeError in cases where link_libpython is False but no C
compiler is available.
Fixes mesonbuild#16024
Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
python.dependency()is used in a project without a C compiler (e.g.project('foo', 'rust')), thePythonSystemDependencyfalls back toMissingCompilerwhich raises a generic 'no toolchain found'DependencyException. This is confusing for users who don't realize that detecting the Python library requires a C compiler.This adds an early check in
PythonSystemDependency.__init__that detects whenclib_compileris missing and raises a clear error message:Also guards the
has_header()call againstMissingCompiler.Fixes #16024