Skip to content

Commit

Permalink
Merge pull request #48 from ConorMacBride/distutils-to-setuptools
Browse files Browse the repository at this point in the history
Migrate from Distutils to Setuptools
  • Loading branch information
ConorMacBride authored Dec 24, 2021
2 parents 2a2f37e + 2c6aaba commit 2443a06
Showing 1 changed file with 4 additions and 8 deletions.
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

0 comments on commit 2443a06

Please # to comment.