26
26
import warnings
27
27
28
28
import distutils
29
- from distutils import ccompiler
30
-
31
- if ccompiler .get_default_compiler () == 'msvc' :
32
- try :
33
- # MSVC 2017 support (setuptools >= 34.4.0)
34
- from setuptools import Extension
35
- except ImportError :
36
- from distutils .core import Extension
37
- else :
38
- from distutils .core import Extension
29
+ from distutils .core import Extension
39
30
40
31
import Cython
41
32
from Cython .Build .Inline import _get_build_extension
@@ -283,6 +274,8 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
283
274
('BOOST_NO_DECLTYPE' , None ),
284
275
('BOOST_DISABLE_ASSERTS' , None ),
285
276
]
277
+
278
+ build_extension = _get_build_extension ()
286
279
# compile stan models with optimization (-O2)
287
280
# (stanc is compiled without optimization (-O0) currently, see #33)
288
281
if extra_compile_args is None :
@@ -292,7 +285,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
292
285
'-Wno-unused-function' ,
293
286
'-Wno-uninitialized' ,
294
287
]
295
- if platform .platform ().startswith ('Win' ) and ccompiler . get_default_compiler () == 'msvc' :
288
+ if platform .platform ().startswith ('Win' ) and build_extension . compiler == 'msvc' :
296
289
extra_compile_args = ['/EHsc' , '-DBOOST_DATE_TIME_NO_LIB' ]
297
290
298
291
distutils .log .set_verbosity (verbose )
@@ -304,7 +297,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
304
297
extra_compile_args = extra_compile_args )
305
298
306
299
cython_include_dirs = ['.' , pystan_dir ]
307
- build_extension = _get_build_extension ()
300
+
308
301
build_extension .extensions = cythonize ([extension ],
309
302
include_path = cython_include_dirs ,
310
303
quiet = not verbose )
0 commit comments