-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Suggestion: Make Python dependency raise error/warning in shared_library instead of shared_module #14051
Comments
It's not incorrect to do so -- there are (plenty of) people that use python's C-API to embed python, rather than extend it. Embedding means your application links to If you're building a python module, please don't use |
Indeed, I figure out That said, how come |
Because the original design of the module made the judgment call that people by default use |
I see. Is there any way for the dependency to detect whether it's used inside |
In theory we could add a special-cased loop in shared_library that checks for every single project, whether any dependency happens to be a python dependency, and if so, warns when It's not necessarily difficult to do this, the question is more whether it is worth adding a bunch of code for what may be a documentation error and anyways doesn't seem to occur very often. |
I see. What I think about the issue:
|
A hook interface would just be a formal extensibility mechanism that implements a loop over dependencies. Hook abstractions are something you add in when you expect to generically treat objects in a way that you'd want to commonly override. The issue here is that checking the project name of a dependency in the frontend and doing special consistency checks is a rather special need, whereas usually we just pass around opaque dependency objects and unpack them in the backend, when writing out a ninja file. We don't have another frontend use case for doing anything with dependencies other than forwarding them to the backend, so we'd have to add a special case to There are likewise no existing hook points in dependency objects themselves that accept arbitrary information about the build artifact they are being used in for the sake of performing arbitrary calculations on them e.g. in this case emitting a warning if they are used with a shared library, because dependency objects always sit lower on the data model and just need to emit their linkage requirements when asked. |
Currently, if
shared_library
instead ofshared_module
is used by mistake e.g. #9777 then a hard-to-understand linker error results.Suggestion: can
py.dependency()
automatically detectshared_library
being used instead ofshared_module
and suggest a better one to be used?MWE:
Error:
The text was updated successfully, but these errors were encountered: