Move most of setup.py to pyproject.toml.

The custom setuptools_scm configuration is removed. It was buggy (for
the case of a dirty worktree exactly at the tag, it did not append
`+dirty`) and otherwise is only different from node-and-timestamp by
appending `.dirty` instead of `.dYYYYMMDDHHMMSS`. The latter is
preferable anyway.
This commit is contained in:
Catherine 2023-02-02 20:35:58 +00:00
parent cd7dfeee31
commit 732d62eb24
2 changed files with 33 additions and 44 deletions

View file

@ -1,3 +1,32 @@
[build-system] [build-system]
requires = ["wheel", "setuptools~=62.0", "setuptools_scm"] requires = ["wheel", "setuptools~=67.0", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[project]
dynamic = ["version", "urls"]
name = "amaranth"
description = "Amaranth hardware definition language"
authors = [{name = "Amaranth HDL contributors"}]
license = {file = "LICENSE.txt"}
requires-python = "~=3.7"
dependencies = [
"importlib_metadata; python_version<'3.8'", # for __version__ and amaranth._toolchain.yosys
"importlib_resources; python_version<'3.9'", # for amaranth._toolchain.yosys
"pyvcd>=0.2.2,<0.4", # for amaranth.sim.pysim
"Jinja2~=3.0", # for amaranth.build
]
[project.optional-dependencies]
# this version requirement needs to be synchronized with the one in amaranth.back.verilog!
# due to the issue described in https://github.com/pypa/setuptools/issues/3807, this is
# temporarily pinned to a specific amaranth-yosys version.
builtin-yosys = ["amaranth-yosys==0.10.0.dev47"]
remote-build = ["paramiko~=2.7"]
[project.scripts]
amaranth-rpc = "amaranth.rpc:main"
[tool.setuptools_scm]
local_scheme = "node-and-timestamp"

View file

@ -1,25 +1,8 @@
from setuptools import setup, find_packages from setuptools import setup
from setuptools_scm.git import parse as parse_git
def scm_version():
def local_scheme(version):
if version.tag and not version.distance:
return version.format_with("")
else:
return version.format_choice("+{node}", "+{node}.dirty")
return {
"relative_to": __file__,
"version_scheme": "guess-next-dev",
"local_scheme": local_scheme
}
def doc_version(): def doc_version():
try:
from setuptools_scm.git import parse as parse_git
except ImportError:
return ""
git = parse_git(".") git = parse_git(".")
if not git: if not git:
return "" return ""
@ -30,31 +13,8 @@ def doc_version():
setup( setup(
name="amaranth",
use_scm_version=scm_version(),
author="Amaranth HDL contributors",
description="Amaranth hardware definition language",
#long_description="""TODO""",
license="BSD",
python_requires="~=3.7",
install_requires=[
"importlib_metadata; python_version<'3.8'", # for __version__ and amaranth._toolchain.yosys
"importlib_resources; python_version<'3.9'", # for amaranth._toolchain.yosys
"pyvcd>=0.2.2,<0.4", # for amaranth.pysim
"Jinja2~=3.0", # for amaranth.build
],
extras_require={
# this version requirement needs to be synchronized with the one in amaranth.back.verilog!
"builtin-yosys": ["amaranth-yosys>=0.10.*"],
"remote-build": ["paramiko~=2.7"],
},
packages=find_packages(exclude=("tests", "tests.*")),
entry_points={
"console_scripts": [
"amaranth-rpc = amaranth.rpc:main",
]
},
project_urls={ project_urls={
"Homepage": "https://amaranth-lang.org/",
"Documentation": "https://amaranth-lang.org/docs/amaranth/{}".format(doc_version()), "Documentation": "https://amaranth-lang.org/docs/amaranth/{}".format(doc_version()),
"Source Code": "https://github.com/amaranth-lang/amaranth", "Source Code": "https://github.com/amaranth-lang/amaranth",
"Bug Tracker": "https://github.com/amaranth-lang/amaranth/issues", "Bug Tracker": "https://github.com/amaranth-lang/amaranth/issues",