Closed srio closed 2 years ago
Hi Manolo,
I am doing fine and hope that the same goes for you.
To get the shared libraries into the right folder, try invoking meson
as:
meson setup builddir --buildtype=release --prefix=/users/srio/miniconda3 --libdir=lib
I have no trouble building wheels, using the included pyproject.toml
:
$ python -m pip wheel .
Processing /Users/schoon/github/xraylib
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: xraylib
Building wheel for xraylib (pyproject.toml) ... done
Created wheel for xraylib: filename=xraylib-4.1.2-cp38-cp38-macosx_10_9_x86_64.whl size=16376814 sha256=2e18894a34a319c70f66920acd0517435d7748c7697b722df40df85510e65270
Stored in directory: /private/var/folders/jl/d923r8796731jz89cqsytvkc0000gn/T/pip-ephem-wheel-cache-bw8cntm8/wheels/45/9e/eb/a271079890e68de9ec730dad2f6168c2018e0c42a587b93470
Successfully built xraylib
$ python -m pip install xraylib-4.1.2-cp38-cp38-macosx_10_9_x86_64.whl
This works on Linux and macOS. I have produced a patch for mesonpep517 to add support for Windows, but the project seems to be unmaintained.
Ah, you should not use the official release tarball for building with mesonpep517: use the git checkout instead
Thanks a lot Tom. It works beautifully! It is great, this is very helpful!
For my own memorandum, I summarize the process:
git clone https://github.com/tschoonj/xraylib
cd xraylib
git checkout mesonpep517
python -m pip wheel .
python -m pip install xraylib-4.1.1-cp37-cp37m-linux_x86_64.whl
Meson recently added a builtin option: -Dpython.install_env=auto
-- the default, behavior-preserving value is "prefix" which plays nicely with a linux distro derived python, but not a custom miniconda prefix.
Specifically, lib/x86_64-linux-gnu seems like a misdetected "Debian" install layout mode.
Dear Tom, How are you doing? I am upgrading our python tools with a newer xraylib. I discovered in the new versions the installation using meson. It is great, I managed to compile and install in a few minutes... Much simpler than the gnutools! Great job!
Still, I have one small issue:
Although I know that there is the conda installer, I wanted to compile xraylib and install the python binder. I managed to do it using your instructions:
This places correctly the py files, but the library files are created in /users/srio/miniconda3/lib/x86_64-linux-gnu/ and are not found when I "import xraylib". I moved by hand
mv /users/srio/miniconda3/lib/x86_64-linux-gnu/* /users/srio/miniconda3/lib/
and everything runs perfectly! Any idea to avoid this manual intervention?I have seen that there is a way to create python wheels with meson, using https://pypi.org/project/mesonpep517/ I tried, but I did not managed to get something working. It should be necessary to add a conf file
myproject.toml
and then it should be sufficient toI am not able to create the correct *.tolm file. This solution would be very interesting for us. Also, the wheels created with it are always useful for non-conda installations.
What do you think? Would be feasible to quickly create wheels with meson?
Kind regards, M