#########################
# build-system settings #
#########################

[build-system]
requires = [
    "build",
    "cmake>=3.18",
    "meson",
    "ninja",
    "numpy",
    "scikit-build>=0.13",
    "setuptools",
    "setuptools<65; python_version<'3.12'",
    "setuptools_scm",
    "wheel",
]


####################
# project settings #
####################

[project]
name = "bdsf"
dynamic = ["version"]
description = "Blob Detector and Source Finder"
readme = "README.rst"
requires-python = ">=3.10"
authors = [
    { name = "David Rafferty", email = "drafferty@hs.uni-hamburg.de" },
]
maintainers = [
    { name = "Marcel Loose", email = "loose@astron.nl" },
]
license = { file = "LICENSE" }
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Science/Research",
    "Programming Language :: C++",
    "Programming Language :: Fortran",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Topic :: Scientific/Engineering :: Astronomy",
]
dependencies = [
    "backports.shutil_get_terminal_size",
    "astropy",
    "numpy",
    "scipy",
]

[project.optional-dependencies]
"ishell" = [
    "ipython!=8.11.*,!=8.12.*,!=8.13.*,!=8.14.*,!=8.15.*",
    "matplotlib",
]

[project.scripts]
pybdsf = "bdsf.pybdsf:main [ishell]"

[project.urls]
Homepage = "https://github.com/lofar-astron/PyBDSF"
Documentation = "https://pybdsf.readthedocs.io"


#########################
# cibuildwheel settings #
#########################

[tool.cibuildwheel]
before-all = "cibuildwheel/before_all.sh"
before-build = "cibuildwheel/before_build.sh"
build = "cp3{10,11,12,13,14}-*"
build-verbosity = 1
environment = """ \
    BOOST_VERSION="1.91.0" \
    BOOST_BUILD_DIR="/tmp/boost-build" \
    BOOST_INSTALL_DIR="${HOME}/boost" \
    BOOST_ROOT="${BOOST_INSTALL_DIR}" \
    CC=gcc \
    CXX=g++ \
    CXXFLAGS="-I${BOOST_INSTALL_DIR}/include -L${BOOST_INSTALL_DIR}/lib" \
    FC=gfortran \
    LD_LIBRARY_PATH="${BOOST_INSTALL_DIR}/lib" \
"""
test-command = "cd {package}/test && python tbdsf_process_image.py"

[tool.cibuildwheel.macos]
repair-wheel-command = """\
    DYLD_LIBRARY_PATH=${BOOST_INSTALL_DIR}/lib delocate-wheel \
    --require-archs {delocate_archs} -w {dest_dir} -v {wheel}\
"""

[tool.cibuildwheel.linux]
skip = ["*-musllinux_*", "*_i686"]


###########################
# setuptools_scm settings #
###########################

[tool.setuptools_scm]
version_file = "bdsf/_version.py"
