diff --git a/setup.py b/setup.py index 2fb0f1ca..fc1bda88 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ """ no_wheel_message = """ -You need to have wheel installed to pip_install snappy, e.g., +You need to have wheel installed to install snappy, e.g., sudo python -m pip install "wheel" @@ -51,10 +51,15 @@ except ImportError: raise ImportError(no_setuptools_message) +try: + import wheel +except ImportError: + raise ImportError(no_wheel_message) + import os, platform, shutil, site, subprocess, sys, sysconfig, re from os.path import getmtime, exists -from distutils.ccompiler import get_default_compiler from glob import glob +import importlib.metadata if sys.platform == 'darwin': # On macOS, the C and C++ code generated by Cython produces lots of these. @@ -76,7 +81,6 @@ from setuptools.extension import Extension from setuptools import setup, Command -from pkg_resources import load_entry_point # A real clean @@ -124,7 +128,8 @@ def run(self): import sphinx_rtd_theme except ImportError: raise ImportError(no_sphinx_theme_message) - sphinx_cmd = load_entry_point('sphinx>=1.7', 'console_scripts', 'sphinx-build') + sphinx_dist = importlib.metadata.Distribution.from_name('sphinx') + sphinx_cmd = sphinx_dist.entry_points['sphinx-build'].load() sphinx_args = ['-a', '-E', '-d', 'doc_src/_build/doctrees', 'doc_src', 'python/doc'] sys.path.insert(0, build_lib_dir()) @@ -367,12 +372,13 @@ def add(self, source_file, dependency_mod_time=0.0): for hp_file in hp_qd_code: hp_snappy_ext_files.add(hp_file) -# The compiler we will be using +# For Windows, check the compiler we will be using. -cc = get_default_compiler() -for arg in sys.argv: - if arg.startswith('--compiler='): - cc = arg.split('=')[1] +if sys.platform == 'win32': + cc = 'msvc' + for arg in sys.argv: + if arg.startswith('--compiler='): + cc = arg.split('=')[1] # The SnapPy extension snappy_extra_compile_args = []