diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1df304b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel", "numpy", "Cython"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 041736f..134d0e5 100644 --- a/setup.py +++ b/setup.py @@ -1,28 +1,28 @@ import os - -import numpy from setuptools import Extension, find_packages, setup -try: - from Cython.Build import cythonize - - ext = ".pyx" -except ImportError: - cythonize = None - ext = ".cpp" -ext_modules = [ - Extension( - "ffm.libffm", - extra_compile_args=["-Wall", "-O3", "-std=c++0x", "-march=native", "-DUSESSE"], - sources=[os.path.join("ffm", "libffm" + ext), "ffm.cpp"], - include_dirs=[".", numpy.get_include()], - language="c++", - ) -] +def make_extensions(): + import numpy + try: + from Cython.Build import cythonize + ext = ".pyx" + except ImportError: + cythonize = None + ext = ".cpp" + ext_modules = [ + Extension( + "ffm.libffm", + extra_compile_args=["-Wall", "-O3", "-std=c++0x", "-march=native", "-DUSESSE"], + sources=[os.path.join("ffm", "libffm" + ext), "ffm.cpp"], + include_dirs=[".", numpy.get_include()], + language="c++", + ) + ] + if cythonize is not None: + ext_modules = cythonize(ext_modules) + return ext_modules -if cythonize is not None: - ext_modules = cythonize(ext_modules) setup( name="ffm", @@ -30,7 +30,7 @@ description="LibFFM Python Package", long_description="LibFFM Python Package", install_requires=["numpy"], - ext_modules=ext_modules, + ext_modules=make_extensions(), maintainer="", maintainer_email="", zip_safe=False,