[Debichem-devel] Packaging of spglib

Alex Mestiashvili amestia at rsh2.donotuse.de
Thu Mar 29 15:13:47 UTC 2018


> On 03/29/2018 12:26 AM, Alex Mestiashvili wrote:
>> 2. no python3 bindings, as far as I see spglib can be used with python3
>> too, but currently package is only build with python2.
> 
> How do you know that it can be used with Python3? I see no other way of building Python3 bindings without rewriting/translating the Python2 code of spglib, what would be a time-consuming and risky thing to do for non-upstream.

You can pass the python interpreter. To build pyhton3 module, you call
python3 setup.py install. No need to modify the code.

So basically you'll need to override dh_build and build 2 versions of
python modules, once calling python2 and second time python3.
A build system like pybuild can save you some typing, but basically
you'll need to override dh_build, dh_auto_install and dh_install to
install separate python versions.

I've managed to build both python modules with this d/rules:

<skip>

PY2VERS = $(shell pyversions -v -d)
PY3VERS = $(shell py3versions -v -d)

%:
        dh $@ --buildsystem cmake --with python2,python3

override_dh_build:
        dh_build
        dh_build --buildsystem pybuild --sourcedirectory python

override_dh_auto_install:
        dh_auto_install
        dh_auto_install --buildsystem pybuild --sourcedirectory python

override_dh_install:
        dh_install -ppython-spglib
debian/tmp/usr/lib/python$(PY2VERS)/dist-packages/spglib
        dh_install -ppython3-spglib
debian/tmp/usr/lib/python$(PY3VERS)/dist-packages/spglib
        dh_install

Don't forger to add python3-spglib and python3 deps to d/control.
Didn't have time to test anything though.
A great source of examples is https://codesearch.debian.net.

Best regards,
Alex



More information about the Debichem-devel mailing list