From 41600e63c1dd3094159d85a28bf134d537356dcf Mon Sep 17 00:00:00 2001 From: Forest Gregg Date: Sat, 16 Dec 2023 08:59:17 -0500 Subject: [PATCH] add link option --- pyproject.toml | 4 +--- setup.py | 42 +++++++++--------------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c1cc3c8..a8189d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,4 @@ requires = ["setuptools", "wheel", "cython", - "numpy==1.14.0; python_version=='3.6' and platform_system=='Windows' and (platform_machine=='x86' or platform_machine=='AMD64') and platform_python_implementation=='CPython'", - "numpy==1.14.0; python_version=='3.5' and platform_system=='Windows' and (platform_machine=='x86' or platform_machine=='AMD64') and platform_python_implementation=='CPython'", - "oldest_supported_numpy; platform_system!='Windows' or (python_version!='3.5' and python_version!='3.6') or (platform_machine!='x86' and platform_machine!='AMD64') or platform_python_implementation!='CPython'"] + "oldest_supported_numpy"] diff --git a/setup.py b/setup.py index a5f5046..695d764 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ -from os.path import join, abspath +from os.path import abspath, join +from Cython.Build import cythonize import numpy from setuptools import Extension, setup @@ -8,53 +9,28 @@ # Add path for npymath libraries: lib_path = [abspath(join(numpy.get_include(), "..", "lib"))] -try: - from Cython.Build import cythonize - use_cython = True -except ImportError: - use_cython = False - -if use_cython: - ext_modules = cythonize( - [ - Extension( - "pyhacrf.algorithms", - ["pyhacrf/algorithms.pyx"], - extra_compile_args=["-ffast-math", "-O4"], - include_dirs=[inc_path], - library_dirs=lib_path, - libraries=["npymath"], - define_macros=defs, - ), - Extension( - "pyhacrf.adjacent", - ["pyhacrf/adjacent.pyx"], - include_dirs=[numpy.get_include()], - extra_link_args=["-lm"], - extra_compile_args=["-ffast-math", "-O4"], - ), - ] - ) -else: - ext_modules = [ +ext_modules = cythonize( + [ Extension( "pyhacrf.algorithms", - ["pyhacrf/algorithms.c"], + ["pyhacrf/algorithms.pyx"], extra_compile_args=["-ffast-math", "-O4"], include_dirs=[inc_path], library_dirs=lib_path, libraries=["npymath"], + extra_link_args=["-lm"], define_macros=defs, ), Extension( "pyhacrf.adjacent", - ["pyhacrf/adjacent.c"], - extra_link_args=["-lm"], + ["pyhacrf/adjacent.pyx"], include_dirs=[numpy.get_include()], + extra_link_args=["-lm"], extra_compile_args=["-ffast-math", "-O4"], ), ] +) def readme():