This article is the 9th day of ** ADVENTAR ** Python Advent Calendar 2015, not Qiita.
delocate is a wheel package utility for OS X. Matthew Brett
It has the following functions
--Show the libraries that wheel depends on --Copy and rewrite dependent libraries in the wheel to link
Let me give you an example.
For an example, I will use the wheel file of the latest version of the cell simulator called E-Cell. If you want to build your own wheel file before delocate https://github.com/ecell/ecell4-wheels/blob/master/.travis.yml Please refer to before delocate
First try the delocate-listdeps command
> delocate-listdeps --all dist/ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.whl
/usr/lib/libSystem.B.dylib
/usr/lib/libc++.1.dylib
/usr/local/Cellar/gsl/1.16/lib/libgsl.0.dylib
/usr/local/Cellar/gsl/1.16/lib/libgslcblas.0.dylib
/usr/local/Cellar/hdf5/1.8.16/lib/libhdf5.10.dylib
/usr/local/Cellar/hdf5/1.8.16/lib/libhdf5_cpp.11.dylib
The wheel file ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.whl is homebrew You can see that it depends on gsl and hdf5.
--all
By default with no options/usr/lib
When/system
Does not show the libraries inside.
(It seems that the libraries in them are common in OSX and you don't have to worry about them.)
Even if the above wheel package is distributed as it is
--I have homebrew installed in the default path --I have gsl version 1.16 and hdf5 1.8.16 installed --OSX version is 10.11
Only people can use it. (To be exact, only the third point is "I can't install the wheel" rather than not being able to use it. Details will be described later.)
This is because the wheel package expects the path confirmed by delocate-listdeps
to the library to be dynamically linked.
The `` `delocate-wheel``` command rewrites this so that it does not depend on the environment. An example is shown.
> delocate-wheel dist/ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.whl
> delocate-listdeps dist/ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.whl
@loader_path/.dylibs/libgsl.0.dylib
@loader_path/.dylibs/libgslcblas.0.dylib
@loader_path/.dylibs/libhdf5.10.dylib
@loader_path/.dylibs/libhdf5_cpp.11.dylib
@loader_path/libhdf5.10.dylib
@loader_path/libsz.2.0.0.dylib
You can see that the delocate-wheel command moves dylib into the tree of expected path wheels. Not only has the expected path changed, but the dylib has been copied to be included in the wheel package. (You can see it by renaming whl to zip and unzipping it)
I was able to include the dependent libraries in the wheel with the delocate-wheel command, but the last issue remains that only "OS X version 10.11" mentioned above can be supported.
As specified in PEP 0427 This is because the last tag in the wheel filename indicates the platform. (Now this is macosx_10_11_intel.)
The command to add a platform to this is `` `delocate-addplat```. Here is an example.
> delocate-addplat --rm-orig -x 10_9 -x 10_10 dist/ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.whl
> ls dist/
ecell4-4.0.0b2-cp27-none-macosx_10_11_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
You can see that the platform has been added.
I'm tired of putting it together, so that's it.
Recommended Posts