Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Migrate from Distutils to Setuptools #48

Merged
merged 2 commits into from
Dec 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@

import os
from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from setuptools.command.build_ext import build_ext


class build_ext(build_ext):

def build_extension(self, ext):
self._ctypes = isinstance(ext, CTypes)
return super().build_extension(ext)

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

def get_ext_filename(self, ext_name):
if self._ctypes:
if isinstance(self.ext_map[ext_name], CTypes):
# Ensure that the extension ends in ".so"
# Modified version of parent method
from distutils.sysconfig import get_config_var
from setuptools.command.build_ext import get_config_var
ext_suffix = get_config_var('EXT_SUFFIX')
expanded_suffix = ext_suffix.split('.')
expanded_suffix[-1] = "so"
Expand Down