[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools"]

[project]
name = "SCons"
description = "Open Source next-generation build tool."
requires-python = ">=3.7"
license = "MIT"  # PEP 639 form (new - setuptools >= 77.0)
# Should include docbook license, but this fails:
# license = "MIT AND DocBook-stylesheet"
license-files = [
    "LICENSE",
    "SCons/Tool/docbook/docbook-xsl-1.76.1/COPYING",
]
readme = { file = "README-package.rst", content-type = "text/x-rst" }
authors = [{ name = "William Deegan", email = "bill@baddogconsulting.com" }]
dynamic = ["version"]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Topic :: Software Development :: Build Tools",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.7",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "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",
    "Environment :: Console",
    "Intended Audience :: Developers",
    "Operating System :: POSIX :: Linux",
    "Operating System :: Unix",
    "Operating System :: MacOS",
    "Operating System :: Microsoft :: Windows",
]

[project.urls]
Homepage = "https://www.scons.org/"
Documentation = "https://scons.org/documentation.html"
Twitter = "https://twitter.com/SConsProject"
GitHub = "https://github.com/SCons/scons"
Bug-Tracker = "https://github.com/SCons/scons/issues"
Discord = "https://discord.gg/pejaFYrD9n"
"Mailing lists" = "https://scons.org/lists.html"

[project.scripts]
scons = "SCons.Script.Main:main"
sconsign = "SCons.Utilities.sconsign:main"
scons-configure-cache = "SCons.Utilities.ConfigureCache:main"

# Extra deps for development.
[dependency-groups]
dev = [
    "ninja",
    "psutil",
    "lxml",
]
pkg = [
    { include-group = "dev" },
    "readme-renderer",
    "sphinx",
    "sphinx-book-theme",
    "rst2pdf",
    "build",
    "twine",
    "packaging",
    # pdf doc build suggests this for better results, excluded for now:
    # "matplotlib",
]

# Features users can opt into. Currently none.
# [project.optional-dependencies]

[tool.setuptools]
zip-safe = false
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "SCons.__version__"}

[tool.setuptools.packages.find]
include = ["SCons*"]
namespaces = false

[tool.setuptools.package-data]
"*" = ["*.txt", "*.rst", "*.1"]
"SCons.Tool.docbook" = ["*.*"]

[tool.distutils.sdist]
dist-dir = "build/dist"

[tool.distutils.bdist_wheel]
dist-dir = "build/dist"

[tool.ruff]
target-version = "py37" # Lowest python version supported
extend-include = ["SConstruct", "SConscript"]
extend-exclude = [
    "bench/",
    "bin/",
    "doc/",
    "src/",
    "template/",
    "test/",
    "testing/",
    "timings/",
    "SCons/Tool/docbook/docbook-xsl-1.76.1/",
]

[tool.ruff.lint]
extend-select = [
    "FA", # Future annotations
    "UP006", # Use {to} instead of {from} for type annotation
    "UP007", # Use `X | Y` for type annotations
    "UP037", # Remove quotes from type annotation
]
extend-safe-fixes = ["FA", "UP006", "UP007"]

[tool.ruff.format]
quote-style = "preserve" # Equivalent to black's "skip-string-normalization"

[tool.mypy]
# version should be oldest supported by SCons, but mypy has moved on.
# can't *run* mypy with 3.9, but can still check against it, for now.
python_version = "3.9"
exclude = [
    "^bench/",
    "^bin/",
    "^doc/",
    "^src/",
    "^template/",
    "^test/",
    "^testing/",
    "^timings/",
    "^SCons/Tool/docbook/docbook-xsl-1.76.1/",
]

# TODO: need a matching section for pyright? (doesn't read [tool.mypy]
