Port shtns python module to setuptools
- Add
pyproject.toml
in the entryAC_CONFIG_FILES
ofconfigure.ac
AC_CONFIG_FILES([Makefile setup.py pyproject.toml])
- Create
pyproject.toml
[project]
name = "SHTns"
version = "3.6"
authors = [
{ name="Nathanael Schaeffer", email="nathanael.schaeffer@univ-grenoble-alpes.fr" },
]
description = "High performance Spherical Harmonic Transform"
dependencies = [
'numpy',
]
readme = "README"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: CeCILL Free Software License Agreement v2.1",
]
[tool.setuptools.packages.find]
include = ["shtns.py"] # package names should match these glob patterns (["*"] by default)
[build-system]
requires = ["setuptools>=61.0", "wheel", "Cython>=0.29", "numpy >= 1.15"]
build-backend = "setuptools.build_meta"
- change
setup.py.in
# Python setup
from setuptools import Extension, setup
from numpy import get_include
numpy_inc = get_include() # NumPy include path.
objs = "sht_init.o sht_kernels_a.o sht_kernels_s.o sht_odd_nlat.o @objs@"
shtns_o = objs.split() # transform to list of objects
libdir = "@prefix@"
if len(libdir) == 0:
libdir = []
else:
libdir = [libdir + "/lib"]
cargs = '-std=c99 @OPENMP_CFLAGS@ -DSHTNS_VER="' + str(@PACKAGE_VERSION@) + '"'
largs = "@LDFLAGS@"
libs = "@LIBS@"
libslist = libs.replace("-l", "").split() # transform to list of libraries
setup(
ext_modules=[
Extension(
name="_shtns",
sources=["shtns_numpy_wrap.c"],
extra_objects=shtns_o,
depends=shtns_o,
extra_compile_args=cargs.split(),
extra_link_args=largs.split(),
library_dirs=libdir,
libraries=libslist,
include_dirs=[numpy_inc],
),
]
)
It is not working currently, missing *.o
files
Edited by Paolo Personnettaz