From 732d62eb2412e38f6a0ccd4a6efc59a5c73898b7 Mon Sep 17 00:00:00 2001 From: Catherine Date: Thu, 2 Feb 2023 20:35:58 +0000 Subject: [PATCH] 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. --- pyproject.toml | 31 ++++++++++++++++++++++++++++++- setup.py | 46 +++------------------------------------------- 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e6670cf..ccc91e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,32 @@ [build-system] -requires = ["wheel", "setuptools~=62.0", "setuptools_scm"] +requires = ["wheel", "setuptools~=67.0", "setuptools_scm[toml]>=6.2"] 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" diff --git a/setup.py b/setup.py index b56b301..56c67e2 100644 --- a/setup.py +++ b/setup.py @@ -1,25 +1,8 @@ -from setuptools import setup, find_packages - - -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 - } +from setuptools import setup +from setuptools_scm.git import parse as parse_git def doc_version(): - try: - from setuptools_scm.git import parse as parse_git - except ImportError: - return "" - git = parse_git(".") if not git: return "" @@ -30,31 +13,8 @@ def doc_version(): 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={ + "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",