0

I am trying to simplify the installation of a ctypes python module. However I do not understand how to control the suffix mechanism in setuptools.Extension.

poetry install gives me either:

error: can't copy 'build\lib.win-amd64-cpython-310\libdicm.cp310-win_amd64.pyd': doesn't exist or not a regular file

or

error: can't copy 'build/lib.linux-i686-cpython-310/libdicm.cpython-310-x86_64-linux-gnu.so': doesn't exist or not a regular file

How do I control the suffix part of the python name? In my case I want either dicm.dll or libdicm.so.0. It seems to have been supported at some point.

My current setup.py is inspired from:


I am trying to keep the cmake-based build system, and this cannot use the solution described at:

malat
  • 12,152
  • 13
  • 89
  • 158

1 Answers1

0

The following seems to be going in the right direction:

class CMakeBuild(build_ext):
    def get_ext_filename(self, ext_name):
        if platform.system() == "Windows":
            return "dicm.dll"
        elif platform.system() == "Darwin":
            return "libdicm.dylib"
        else:
            return "libdicm.so.0"

    def get_export_symbols(self, ext):
        return ext.export_symbols

Reference:

malat
  • 12,152
  • 13
  • 89
  • 158