Skip to content

Commit

Permalink
fixup5
Browse files Browse the repository at this point in the history
  • Loading branch information
James-E-A committed Jan 26, 2024
1 parent 3512374 commit 8a1b56a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
from distutils.command.build_ext import build_ext as _build_ext
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel


class build_ext(_build_ext):
"""https://github.com/joerick/python-ctypes-package-sample/blob/7db688cd6ee32ae95bce0f75fb7d806926e20252/setup.py#L11"""
def build_extension(self, ext):
self._ctypes = isinstance(ext, CTypesExtension)
return super().build_extension(ext)

def get_export_symbols(self, ext):
if self._ctypes:
return ext.export_symbols
return super().get_export_symbols(ext)

def get_ext_filename(self, ext_name):
if self._ctypes:
return ext_name + ".so"
return super().get_ext_filename(ext_name)


class bdist_wheel_abi_none(_bdist_wheel):
"""https://github.com/joerick/python-ctypes-package-sample/blob/7db688cd6ee32ae95bce0f75fb7d806926e20252/setup.py#L29"""
def finalize_options(self):
Expand All @@ -15,6 +33,7 @@ def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
return "py3", "none", plat


setup(
cmdclass={"build_ext": build_ext, "bdist_wheel": bdist_wheel_abi_none},
cffi_modules=[
Expand Down

0 comments on commit 8a1b56a

Please sign in to comment.