diff --git a/setup.py b/setup.py index 5b05e71..029a0cb 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,4 @@ -import platform -import sys from setuptools import setup, find_packages -from setuptools.command.build_ext import build_ext from codecs import open from os import path @@ -11,18 +8,6 @@ long_description = f.read() -class custom_build_ext(build_ext): - """Custom build_ext command that uses mingw32 when building on Python2.7 - in Windows.""" - - def finalize_options(self): - build_ext.finalize_options(self) - is_windows = platform.system() == 'Windows' - is_py2 = sys.version_info[0] < 3 - if self.compiler is None and is_windows and is_py2: - self.compiler = 'mingw32' - - setup( name='cmarkgfm', version='2024.11.20', @@ -58,7 +43,4 @@ def finalize_options(self): }, zip_safe=False, include_package_data=True, - cmdclass={ - 'build_ext': custom_build_ext, - }, ) diff --git a/src/cmarkgfm/build_cmark.py b/src/cmarkgfm/build_cmark.py index 3d140ca..176ffd1 100644 --- a/src/cmarkgfm/build_cmark.py +++ b/src/cmarkgfm/build_cmark.py @@ -3,7 +3,6 @@ import glob import io import os -import sys import cffi @@ -58,10 +57,11 @@ def _compiler_type(): COMPILER_TYPE = _compiler_type() -PY2 = sys.version_info[0] < 3 -# Note: on Python 2.7 in Windows we're using mingw so we use the unix -# srcs for that as well. -if COMPILER_TYPE in {'unix', 'mingw32'} or PY2: +# Note: on Windows with MSVC the compiler type is 'msvc'. On macOS and +# Linux it is 'unix'. For MinGW on Windows distutils reports 'mingw32'. +# Select the appropriate compile args and generated sources directory +# based solely on the compiler type. +if COMPILER_TYPE in {'unix', 'mingw32'}: EXTRA_COMPILE_ARGS = ['-std=c99'] GENERATED_SRC_DIR = UNIX_GENERATED_SRC_DIR elif COMPILER_TYPE == 'msvc':