Shared library missing from wheel (custom build)
Miki Tebeka
miki.tebeka at gmail.com
Sat Jun 6 05:42:40 EDT 2020
Hi,
I'm playing around with generating extension moudle to Python in Go. This is for a blog post - not production ready.
The Go code is compiled to a shared library and the Python module is using ctypes to call the Go code in the shared library. I know it's know a classic extension module with PyModule_Create and friends, but that's for later... maybe.
The setup.py is defined as
---
from subprocess import call
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
class build_go_ext(build_ext):
def build_extension(self, ext):
ext_path = self.get_ext_filename(ext.name)
cmd = ['go', 'build', '-buildmode=c-shared', '-o', ext_path]
cmd += ext.sources
out = call(cmd)
if out != 0:
raise RuntimeError('Go build failed')
setup(
name='checksig',
version='0.1.0',
py_modules=['checksig'],
ext_modules=[
Extension('_checksig', ['checksig.go', 'export.go'])
],
cmdclass={'build_ext': build_go_ext},
)
---
When I run "python setup.py bdist_wheel", I see that that _checksig.cpython-38-x86_64-linux-gnu.so is being built. But when I look at the content of dist/checksig-0.1.0-cp38-cp38-linux_x86_64.whl it's not there.
What am I missing?
You can view the whole (WIP) project at https://github.com/ardanlabs/python-go/tree/master/pyext
Thanks,
Miki
More information about the Python-list
mailing list