44from distutils import log
55import os
66import sys
7- import pkg_resources
8- from io import open
7+ from importlib . metadata import version as get_version , PackageNotFoundError
8+ from packaging . version import Version
99import re
1010
11-
12- argv = sys .argv [1 :]
13- needs_wheel = {"bdist_wheel" }.intersection (argv )
14- wheel = ["wheel" ] if needs_wheel else []
15-
1611# check if minimum required Cython is available
1712cython_version_re = re .compile (r'\s*"cython\s*>=\s*([0-9][0-9\w\.]*)\s*"' )
1813with open ("pyproject.toml" , "r" , encoding = "utf-8" ) as fp :
2318 break
2419 else :
2520 sys .exit ("error: could not parse cython version from pyproject.toml" )
21+ required_cython = "cython >= %s" % cython_min_version
2622try :
27- required_cython = "cython >= %s" % cython_min_version
28- pkg_resources .require (required_cython )
29- except pkg_resources .ResolutionError :
23+ with_cython = Version (get_version ("cython" )) >= Version (cython_min_version )
24+ except PackageNotFoundError :
3025 with_cython = False
31- else :
32- with_cython = True
3326
3427
3528class cython_build_ext (_build_ext ):
@@ -91,19 +84,11 @@ def run(self):
9184 _sdist .run (self )
9285
9386
94- # need to include this for Visual Studio 2008 doesn't have stdint.h
95- include_dirs = (
96- [os .path .join (os .path .dirname (__file__ ), "vendor" , "msinttypes" )]
97- if os .name == "nt" and sys .version_info < (3 ,)
98- else []
99- )
100-
10187cython_modules = ["parser" , "util" , "writer" , "_test" ]
10288extensions = [
10389 Extension (
10490 "openstep_plist." + mod ,
10591 sources = ["src/openstep_plist/%s.pyx" % mod ],
106- include_dirs = include_dirs ,
10792 language = "c++" ,
10893 extra_compile_args = ["-std=c++11" ] if sys .platform != "win32" else [],
10994 )
@@ -130,7 +115,6 @@ def run(self):
130115 include_package_data = True ,
131116 exclude_package_data = {"" : ["*.cpp" ]},
132117 ext_modules = extensions ,
133- setup_requires = ["setuptools_scm" ] + wheel ,
134118 python_requires = ">=3.8" ,
135119 cmdclass = {"build_ext" : cython_build_ext , "sdist" : cython_sdist },
136120 zip_safe = False ,
0 commit comments