[WIP] PythonPackage: RPATH link dependencies#4545
[WIP] PythonPackage: RPATH link dependencies#4545adamjstewart wants to merge 6 commits intospack:developfrom
Conversation
|
|
||
| def build_scripts_args(self, spec, prefix): | ||
| """Arguments to pass to build_scripts.""" | ||
| return [] |
There was a problem hiding this comment.
This phase was missing a <phase>_args function.
62c03e9 to
cdd1d22
Compare
| # because the package depends on py-setuptools. But the package doesn't | ||
| # actually build with `py-setuptools`, it just needs it at run-time. | ||
| # Until I can figure out how to query direct build dependencies only, | ||
| # override the default `install` method. |
There was a problem hiding this comment.
Does anyone know how to tell if py-setuptools is a direct build dependency?
There was a problem hiding this comment.
@adamjstewart: you can look in setup.py. If it's imported unconditionally and actually used, I consider it one. If it's conditionally imported (e.g. just for some options like building wheels) then you can look at how it's used to figure out if it's actually needed. For most spack use cases it's not needed.
There was a problem hiding this comment.
@tgamblin I mean in Spack world, not Python world. If you look at the install() method in PythonPackage, we add this flag for:
- packages named
py-setuptools, or - packages with a direct dependency on
py-setuptools
But in the case of py-basemap, py-setuptools is a run-dependency only, not a build dependency. How do we check if its a direct build dependency, not just a direct dependency?
There was a problem hiding this comment.
'py-setuptools' in spec.dependencies_dict(deptype='build')There was a problem hiding this comment.
You want to look at dependencies_dict -- it gets you the immediate dependencies for a spec and allows filtering by deptype. There's dependencies_dict, dependents_dict, which get you dicts of specs keyed by name, and there are dependencies and dependents, which get you list of specs.
Currently these just fetch immediate dependencies, but I would like to make it easier to get different sets of dependencies based on relationship, e.g. it would be nice if you could get direct build dependencies plus their transitive run dependencies. Some regex-like syntax would work well there... e.g. spec.find_dependncies('br*'). I haven't thought through how the expression language would look for that.
cdd1d22 to
9158727
Compare
|
Closing as I no longer have the time to work on this. |
See #4522 and #4521 for backstory.
Some Python packages depend on non-Python dependencies. For example,
py-pillowdepends on several imaging libraries. When building these Python packages, Python uses whatever compiler it was built with. Since we filter the compiler wrappers out of the Python installation, this means that we are not using Spack's compiler wrappers when installing Python packages, and hence we are not RPATHing dependencies.Previously, we were building with:
Now, we build with:
The
build_extphase allows us to explicitly declare what RPATH to use, solving the problem. Thanks to @mjwoods for the idea!Additional changes included in this PR:
build_scripts_argsfunction--prefixare added directly in the<phase>function<phase>_args. Overriding this function to try to add additional arguments would remove these default argumentspython setup.py testanymoretestandinstall_testmethods that can be overriddenextendsimpliestype=('build', 'run')nowbuild/link/rundependencies, which doesn't really make much senseextends('python', type=('build', 'link', 'run'))This will likely take a while to test before it is safe to merge. I want to try building and activating every Python package in Spack before we decide to merge this. Who knows, this may even solve #3204 and numpy/numpy#8653.