From 4813ae7dabf5481808c5e4aae78d540df907d5bd Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 22 Jun 2024 11:47:03 -0500 Subject: Migrate to the PDM build system Avoids problems with .git_archival.txt breaking reproducibility. Nabbed from https://github.com/amaranth-lang/amaranth-soc/commit/d66881d83419c689fc96168150e57d9f467723aa --- .git_archival.txt | 4 ---- .gitattributes | 1 - .github/workflows/main.yml | 11 ++++++++--- pyproject.toml | 21 ++++++++------------- setup.py | 4 ---- 5 files changed, 16 insertions(+), 25 deletions(-) delete mode 100644 .git_archival.txt delete mode 100644 .gitattributes delete mode 100644 setup.py diff --git a/.git_archival.txt b/.git_archival.txt deleted file mode 100644 index 8fb235d..0000000 --- a/.git_archival.txt +++ /dev/null @@ -1,4 +0,0 @@ -node: $Format:%H$ -node-date: $Format:%cI$ -describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ -ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index a94cb2f..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -.git_archival.txt export-subst diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43d0efc..7bdf6ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,10 +35,15 @@ jobs: steps: - name: Check out source code uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 + with: + fetch-depth: 0 + - name: Set up PDM + uses: pdm-project/setup-pdm@v3 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pdm install --dev - name: Install Amaranth release if: ${{ matrix.amaranth-version != 'git' }} run: | @@ -49,7 +54,7 @@ jobs: pip install 'amaranth[builtin-yosys] @ git+https://github.com/amaranth-lang/amaranth.git' - name: Run tests run: | - python -m unittest discover -t . -s amaranth_boards -p '*.py' + pdm run test required: # group all required workflows into one to avoid reconfiguring this in Actions settings needs: diff --git a/pyproject.toml b/pyproject.toml index 93a981d..8cf2701 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,8 @@ +# Project metadata + +[tool.pdm.version] +source = "scm" + [project] dynamic = ["version"] @@ -19,18 +24,8 @@ dependencies = [ # Build system configuration [build-system] -requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"] -build-backend = "setuptools.build_meta" - -[tool.setuptools] -# If old amaranth-boards 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_boards` 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_boards"] - -[tool.setuptools_scm] -local_scheme = "node-and-timestamp" +requires = ["pdm-backend"] +build-backend = "pdm.backend" # Development workflow configuration @@ -44,4 +39,4 @@ toolchain = [ [tool.pdm.scripts] _.env_file = ".env.toolchain" -test.cmd = "python -m unittest discover -t . -s amaranth_boards -p *.py" \ No newline at end of file +test.cmd = "python -m unittest discover -t . -s amaranth_boards -p *.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index b024da8..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from setuptools import setup - - -setup() -- cgit v1.2.3