Removed MSVC check.

This commit is contained in:
Josh W 2024-09-03 14:49:34 -04:00
parent 42c2c0cd82
commit 856f522996

View file

@ -1,35 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import platform from setuptools import setup, Extension
from setuptools import setup, find_packages, Extension
from distutils.ccompiler import new_compiler
from distutils.msvccompiler import MSVCCompiler
def is_msvc():
'''Checks to see if the detected C compiler is MSVC.'''
try:
# This depends on _winreg, which is not available on not-Windows.
from distutils.msvc9compiler import MSVCCompiler as MSVC9Compiler
except ImportError:
MSVC9Compiler = None
try:
from distutils._msvccompiler import MSVCCompiler as MSVC14Compiler
except ImportError:
MSVC14Compiler = None
msvc_classes = tuple(filter(None, (MSVCCompiler,
MSVC9Compiler,
MSVC14Compiler)))
cc = new_compiler()
return isinstance(cc, msvc_classes)
macros = []
# MSVC won't use <math.h> unless this is defined.
if platform.system() == 'Windows' and is_msvc():
macros.append(('_USE_MATH_DEFINES', None))
extensions = [ extensions = [
Extension( Extension(
@ -43,7 +15,15 @@ extensions = [
'src/lib/ebur128', 'src/lib/ebur128',
'src/lib/ebur128/queue', 'src/lib/ebur128/queue',
], ],
define_macros=macros, # Not happy about it, but I'll just use this macro on all compilers for
# now. Setuptools doesn't have a reliable way to detect MSVC when they
# started deprecating the older distutils functionality of MSVCCompiler
# and new_compiler(). Besides, looking at the old distutils code, it
# just assumed that MSVC was the compiler if it detected Windows. If you
# wanted GCC/MinGW/LLVM on Windows, you had to manually pass it as an
# argument to new_compiler().
# See https://github.com/pypa/setuptools/issues/2806
define_macros=[('_USE_MATH_DEFINES', None)],
), ),
] ]