Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 688b157

Browse files
authored
Remove msvc 2017 support and update compiler info
Remove msvc 2017 support and wait python to update distutils build_extension moved and updated the compiler info.
1 parent c7c7cfa commit 688b157

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

pystan/model.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,7 @@
2626
import warnings
2727

2828
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
3930

4031
import Cython
4132
from Cython.Build.Inline import _get_build_extension
@@ -283,6 +274,8 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
283274
('BOOST_NO_DECLTYPE', None),
284275
('BOOST_DISABLE_ASSERTS', None),
285276
]
277+
278+
build_extension = _get_build_extension()
286279
# compile stan models with optimization (-O2)
287280
# (stanc is compiled without optimization (-O0) currently, see #33)
288281
if extra_compile_args is None:
@@ -292,7 +285,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
292285
'-Wno-unused-function',
293286
'-Wno-uninitialized',
294287
]
295-
if platform.platform().startswith('Win') and ccompiler.get_default_compiler() == 'msvc':
288+
if platform.platform().startswith('Win') and build_extension.compiler == 'msvc':
296289
extra_compile_args = ['/EHsc', '-DBOOST_DATE_TIME_NO_LIB']
297290

298291
distutils.log.set_verbosity(verbose)
@@ -304,7 +297,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
304297
extra_compile_args=extra_compile_args)
305298

306299
cython_include_dirs = ['.', pystan_dir]
307-
build_extension = _get_build_extension()
300+
308301
build_extension.extensions = cythonize([extension],
309302
include_path=cython_include_dirs,
310303
quiet=not verbose)

0 commit comments

Comments
 (0)