brenthuisman / par2deep

Produce, verify and repair par2 files recursively.
GNU Lesser General Public License v3.0
92 stars 8 forks source link

Make libpar2 wheel #11

Closed brenthuisman closed 4 years ago

brenthuisman commented 4 years ago

The libpar2.h [1] interface is really only two (C++) functions, which should be easy to turn into a Python-lib using pybind11 [2]. [3] is a guide on how to make a wheel out of such a pybind11 package.

A libpar2 wheel could be of general use and make it easier to pip, in that users don't have to find and install par2 anymore.

[1] https://github.com/Parchive/par2cmdline/blob/master/src/libpar2.h [2] https://pybind11.readthedocs.io/en/stable/basics.html [3] https://stackoverflow.com/questions/47599162/pybind11-how-to-package-c-and-python-code-into-a-single-package

brenthuisman commented 4 years ago

libpar2 compiles, and is usable through ctypes. Now I need to figure out how to package a .so and .dll. Like this?

setup(
    name='py_my_lib',
    version=version,  # specified elsewhere
    packages=[''],
    package_dir={'': '.'},
    package_data={'': ['py_my_lib.so']},
)

and then ctypes.CDDL("py_my_lib.so"). Need to compile on Windows and select accordingly.