Skip to content

Commit

Permalink
BLD: partial migration from distutils to setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jun 2, 2022
1 parent 5af4bb9 commit 6fb57c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools>=19.6",
"setuptools>=59.0.1",
# see https://github.com/numpy/numpy/pull/18389
"wheel>=0.36.2",

Expand Down
25 changes: 13 additions & 12 deletions setupext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
import glob
import logging
import os
import platform
import shutil
Expand All @@ -8,17 +9,17 @@
import tempfile
from textwrap import dedent
from concurrent.futures import ThreadPoolExecutor
from distutils import log
from distutils.ccompiler import CCompiler, new_compiler
from distutils.errors import CompileError, LinkError
from distutils.sysconfig import customize_compiler
from subprocess import PIPE, Popen
from sys import platform as _platform

from pkg_resources import resource_filename
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.sdist import sdist as _sdist
from setuptools.errors import CompileError, LinkError

log = logging.getLogger("setupext")

@contextlib.contextmanager
def stdchannel_redirected(stdchannel, dest_filename):
Expand Down Expand Up @@ -114,14 +115,14 @@ def check_for_openmp():
if len(output) == nthreads:
using_openmp = True
else:
log.warn(
log.warning(
"Unexpected number of lines from output of test "
"OpenMP program (output was %s)",
output,
)
using_openmp = False
else:
log.warn(
log.warning(
"Unexpected output from test OpenMP program (output was %s)", output
)
using_openmp = False
Expand All @@ -132,9 +133,9 @@ def check_for_openmp():
os.chdir(start_dir)

if using_openmp:
log.warn("Using OpenMP to compile parallel extensions")
log.warning("Using OpenMP to compile parallel extensions")
else:
log.warn(
log.warning(
"Unable to compile OpenMP test program so Cython\n"
"extensions will be compiled without parallel support"
)
Expand Down Expand Up @@ -193,7 +194,7 @@ def check_CPP14_flags(possible_compile_flags):
if check_CPP14_flag([flags]):
return flags

log.warn(
log.warning(
"Your compiler seems to be too old to support C++14. "
"yt may not be able to compile. Please use a newer version."
)
Expand Down Expand Up @@ -294,18 +295,18 @@ def read_embree_location():
exit_code = p.returncode

if exit_code != 0:
log.warn(
log.warning(
"Pyembree is installed, but I could not compile Embree test code."
)
log.warn("The error message was: ")
log.warn(err)
log.warn(fail_msg)
log.warning("The error message was: ")
log.warning(err)
log.warning(fail_msg)

# Clean up
file.close()

except OSError:
log.warn(
log.warning(
"read_embree_location() could not find your C compiler. "
"Attempted to use '%s'.",
compiler,
Expand Down

0 comments on commit 6fb57c7

Please sign in to comment.