Skip to content

Commit a9a226f

Browse files
authored
chore: remove remaining Python 2.7 concepts (#78)
Refs: #42 Resolves #76 Signed-off-by: Mike Fiedler <[email protected]>
1 parent 0a2e85a commit a9a226f

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

setup.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import platform
2-
import sys
31
from setuptools import setup, find_packages
4-
from setuptools.command.build_ext import build_ext
52
from codecs import open
63
from os import path
74

@@ -11,18 +8,6 @@
118
long_description = f.read()
129

1310

14-
class custom_build_ext(build_ext):
15-
"""Custom build_ext command that uses mingw32 when building on Python2.7
16-
in Windows."""
17-
18-
def finalize_options(self):
19-
build_ext.finalize_options(self)
20-
is_windows = platform.system() == 'Windows'
21-
is_py2 = sys.version_info[0] < 3
22-
if self.compiler is None and is_windows and is_py2:
23-
self.compiler = 'mingw32'
24-
25-
2611
setup(
2712
name='cmarkgfm',
2813
version='2024.11.20',
@@ -58,7 +43,4 @@ def finalize_options(self):
5843
},
5944
zip_safe=False,
6045
include_package_data=True,
61-
cmdclass={
62-
'build_ext': custom_build_ext,
63-
},
6446
)

src/cmarkgfm/build_cmark.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import glob
44
import io
55
import os
6-
import sys
76

87
import cffi
98

@@ -58,10 +57,11 @@ def _compiler_type():
5857

5958

6059
COMPILER_TYPE = _compiler_type()
61-
PY2 = sys.version_info[0] < 3
62-
# Note: on Python 2.7 in Windows we're using mingw so we use the unix
63-
# srcs for that as well.
64-
if COMPILER_TYPE in {'unix', 'mingw32'} or PY2:
60+
# Note: on Windows with MSVC the compiler type is 'msvc'. On macOS and
61+
# Linux it is 'unix'. For MinGW on Windows distutils reports 'mingw32'.
62+
# Select the appropriate compile args and generated sources directory
63+
# based solely on the compiler type.
64+
if COMPILER_TYPE in {'unix', 'mingw32'}:
6565
EXTRA_COMPILE_ARGS = ['-std=c99']
6666
GENERATED_SRC_DIR = UNIX_GENERATED_SRC_DIR
6767
elif COMPILER_TYPE == 'msvc':

0 commit comments

Comments
 (0)