pyproject: migrate to PDM build backend.
`.git_archival.txt` and the functionality of deriving SCM version from a GitHub generated archive is removed pending implementation of pdm-project/pdm-backend#194.
This commit is contained in:
parent
a9d03805ff
commit
d32ca04326
|
@ -1,4 +0,0 @@
|
|||
node: $Format:%H$
|
||||
node-date: $Format:%cI$
|
||||
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
|
||||
ref-names: $Format:%D$
|
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1,2 +1 @@
|
|||
.git_archival.txt export-subst
|
||||
/amaranth/vendor/* -linguist-vendored
|
||||
|
|
13
pdm_build.py
Normal file
13
pdm_build.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
from pdm.backend._vendor.packaging.version import Version
|
||||
|
||||
|
||||
# This is done in a PDM build hook without specifying `dynamic = [..., "version"]` to put all
|
||||
# of the static metadata into pyproject.toml. Tools other than PDM will not execute this script
|
||||
# and will use the generic version of the documentation URL (which redirects to /latest).
|
||||
def pdm_build_initialize(context):
|
||||
version = Version(context.config.metadata["version"])
|
||||
if version.is_prerelease:
|
||||
url_version = "latest"
|
||||
else:
|
||||
url_version = f"v{version}"
|
||||
context.config.metadata["urls"]["Documentation"] += url_version
|
|
@ -1,7 +1,10 @@
|
|||
# Project metadata
|
||||
|
||||
[tool.pdm.version]
|
||||
source = "scm"
|
||||
|
||||
[project]
|
||||
dynamic = ["version", "urls"]
|
||||
dynamic = ["version"]
|
||||
|
||||
name = "amaranth"
|
||||
description = "Amaranth hardware definition language"
|
||||
|
@ -23,21 +26,24 @@ remote-build = ["paramiko~=2.7"]
|
|||
[project.scripts]
|
||||
amaranth-rpc = "amaranth.rpc:main"
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://amaranth-lang.org/"
|
||||
"Documentation" = "https://amaranth-lang.org/docs/amaranth/" # modified in pdm_build.py
|
||||
"Source Code" = "https://github.com/amaranth-lang/amaranth"
|
||||
"Bug Tracker" = "https://github.com/amaranth-lang/amaranth/issues"
|
||||
|
||||
# Build system configuration
|
||||
|
||||
[build-system]
|
||||
requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
|
||||
[tool.setuptools]
|
||||
[tool.pdm.build]
|
||||
# If amaranth 0.3 is checked out with git (e.g. as a part of a persistent editable install or
|
||||
# a git worktree cached by tools like poetry), it can have an empty `nmigen` directory left over,
|
||||
# which causes a hard error because setuptools cannot determine the top-level package.
|
||||
# Add a workaround to improve experience for people upgrading from old checkouts.
|
||||
packages = ["amaranth"]
|
||||
|
||||
[tool.setuptools_scm]
|
||||
local_scheme = "node-and-timestamp"
|
||||
includes = ["amaranth/"]
|
||||
|
||||
# Development workflow configuration
|
||||
|
||||
|
|
25
setup.py
25
setup.py
|
@ -1,25 +0,0 @@
|
|||
from setuptools import setup
|
||||
|
||||
|
||||
def doc_version():
|
||||
try:
|
||||
from setuptools_scm.git import parse as parse_git
|
||||
git = parse_git(".")
|
||||
if git.exact:
|
||||
return git.format_with("v{tag}")
|
||||
else:
|
||||
return "latest"
|
||||
except ImportError:
|
||||
# PEP 517 compliant build tools will never reach this code path.
|
||||
# Poetry reaches this code path.
|
||||
return ""
|
||||
|
||||
|
||||
setup(
|
||||
project_urls={
|
||||
"Homepage": "https://amaranth-lang.org/",
|
||||
"Documentation": "https://amaranth-lang.org/docs/amaranth/{}".format(doc_version()),
|
||||
"Source Code": "https://github.com/amaranth-lang/amaranth",
|
||||
"Bug Tracker": "https://github.com/amaranth-lang/amaranth/issues",
|
||||
},
|
||||
)
|
Loading…
Reference in a new issue