|
1 |
| -from setuptools import setup, find_packages |
| 1 | +from setuptools import setup, find_packages, Extension |
| 2 | +from glob import glob |
| 3 | + |
| 4 | +try: |
| 5 | + from Cython.Build import cythonize |
| 6 | + from Cython.Compiler.Options import get_directive_defaults |
| 7 | + |
| 8 | + use_cython = True |
| 9 | +except ImportError: |
| 10 | + use_cython = False |
| 11 | +import numpy as np |
| 12 | +import os |
| 13 | +import sys |
| 14 | +import versioneer |
| 15 | + |
| 16 | +define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] |
| 17 | + |
| 18 | +if use_cython: |
| 19 | + suffix = ".pyx" |
| 20 | + directive_defaults = get_directive_defaults() |
| 21 | + directive_defaults["binding"] = True |
| 22 | + directive_defaults["language_level"] = 3 |
| 23 | + if os.environ.get("CYTHON_COVERAGE"): |
| 24 | + directive_defaults["linetrace"] = True |
| 25 | + define_macros.append(("CYTHON_TRACE_NOGIL", "1")) |
| 26 | +else: |
| 27 | + suffix = ".c" |
| 28 | + |
| 29 | +include_dirs = [np.get_include(), os.path.join(sys.prefix, "include")] |
| 30 | +ext_modules = [ |
| 31 | + Extension( |
| 32 | + name[: -len(suffix)].replace("/", ".").replace("\\", "."), |
| 33 | + [name], |
| 34 | + include_dirs=include_dirs, |
| 35 | + define_macros=define_macros, |
| 36 | + ) |
| 37 | + for name in glob(f"suitesparse_graphblas/**/*{suffix}", recursive=True) |
| 38 | +] |
| 39 | +if use_cython: |
| 40 | + ext_modules = cythonize(ext_modules, include_path=include_dirs) |
| 41 | + |
| 42 | +with open("README.md") as f: |
| 43 | + long_description = f.read() |
| 44 | + |
| 45 | +package_data = {"suitesparse_graphblas": ["*.pyx", "*.pxd", "*.h"]} |
| 46 | +if sys.platform == "win32": |
| 47 | + package_data["suitesparse_graphblas"].append("*.dll") |
2 | 48 |
|
3 | 49 | setup(
|
4 |
| - name='suitesparse-graphblas', |
5 |
| - version='4.0.3', |
6 |
| - description='SuiteSparse:GraphBLAS Python bindings.', |
| 50 | + name="suitesparse-graphblas", |
| 51 | + version=versioneer.get_version(), |
| 52 | + cmdclass=versioneer.get_cmdclass(), |
| 53 | + description="SuiteSparse:GraphBLAS Python bindings.", |
| 54 | + long_description=long_description, |
| 55 | + long_description_content_type="text/markdown", |
7 | 56 | packages=find_packages(),
|
8 |
| - author='Michel Pelletier, James Kitchen, Erik Welch', |
| 57 | + author="Michel Pelletier, James Kitchen, Erik Welch", |
| 58 | + |
| 59 | + url="https://github.com/GraphBLAS/python-suitesparse-graphblas", |
| 60 | + ext_modules=ext_modules, |
9 | 61 | cffi_modules=["suitesparse_graphblas/build.py:ffibuilder"],
|
10 |
| - install_requires=["cffi>=1.0.0"], |
| 62 | + python_requires=">=3.7", |
| 63 | + install_requires=["cffi>=1.0.0", "numpy>=1.15"], |
11 | 64 | setup_requires=["cffi>=1.0.0", "pytest-runner"],
|
12 | 65 | tests_require=["pytest"],
|
| 66 | + license="Apache License 2.0", |
| 67 | + package_data=package_data, |
| 68 | + include_package_data=True, |
13 | 69 | )
|
14 |
| - |
|
0 commit comments