PythonPackage: add default libs/headers attributes#28527
PythonPackage: add default libs/headers attributes#28527adamjstewart merged 5 commits intospack:developfrom
Conversation
dea66c4 to
dbaf627
Compare
06a01eb to
778cc74
Compare
|
I think my comment #22475 (comment) still applies. This should not be useful for any Python package; if they need this change then they're doing dependency discovery incorrectly in their build config files. Packages typically provide a |
1eda6ac to
2ed30f1
Compare
|
@scottwittenburg this PR is a pretty disruptive change that may possibly break many Python packages in Spack. However, it doesn't change the spec hash, so it looks like GitLab CI is skipped entirely. Is there any way to force run CI? I guess I could add a temp commit to change the default versions of Python and see what breaks... |
|
We still don't have a good way to force rebuilding all the stacks from source :-( But what you suggest is one way to achieve it. However, is it possible that some sub-dags among all the tested stacks involve specific versions of python (rather than the default one), and thus the hashes in those sub-dags still wouldn't change? If that's a possibility, a way to force rebuilding everything is a temporary commit that changes the mirror urls in any stacks you want to be sure to rebuild completely from source. So, e.g.: Far from ideal, I know, but if you're making a temporary commit anyway, something like that (repeat for whatever stacks you want to force rebuild) should do the trick. Note however that after the first pipeline with that temp change, the PR-specific mirror created for your PR will contain cached binaries for any builds that succeeded. |
2ed30f1 to
7209295
Compare
|
GitLab CI passed! I'll revert the last commit now. |
|
So now the only remaining question is whether or not this is the right thing to do. I think @rgommers raises a good point. Unlike most Autotools/CMake packages where libs/headers get installed directly to I can't speak for the rationale in #14513 and #22475, but I added the libs/headers attributes to PyTorch in #18093. I'm guessing I encountered some kind of issue with torchvision finding the PyTorch libs and needed to modify the package, but I wonder if that's really necessary. Our mpi4py package also has headers (added in #17295). Maybe @mdorier @RemiLacroix-IDRIS @sebasgo can chime in with their motivation for #14513 #22475 #17295? |
|
In my original issue, I had developed a python library with C headers and noticed that C/C++ programs could not include it due to the include path having pythonX.Y. Adding a |
|
Pinging other Python maintainers for review: @scheibelp @skosukhin @varioustoxins |
8a4700b to
4e763e1
Compare
scheibelp
left a comment
There was a problem hiding this comment.
I see one minor issue with a variable reference. Otherwise this looks good (FYI style checks appear to be failing)
|
Hmm, this doesn't seem to be working. When I try to build for dep in self.spec.dependencies(deptype='link'):
query = self.spec[dep.name]
include.extend(query.headers.directories)
library.extend(query.libs.directories)it crashes when trying to find Interestingly, it's crashing in |
|
Adding the exact same code from the base class directly to the |
* PythonPackage: add default libs/headers attributes * Style fix * libs and headers should be properties * Check both platlib and include * Fix variable reference
|
@alalazo any ideas on the above bug? |
|
Fixed in #32970 |
This likely needs a bit more thought and testing, but this is a good draft of what I think we should do for Python libraries.
Note that we only search
platlib, notpurelib. For most packages (at least ones that use setuptools), all files are installed toplatlibif the package is not pure-Python. If things are installed in purelib instead of platlib, there likely aren't any libraries/headers anyway.Closes #14513
Closes #22475