Package Details: python-amaranth-git 0.3.r19.g8b85afa-3

Git Clone URL: https://aur.archlinux.org/python-amaranth-git.git (read-only, click to copy)
Package Base: python-amaranth-git
Description: A modern hardware definition language and toolchain based on Python (formerly nMigen)
Upstream URL: https://github.com/amaranth-lang/amaranth
Licenses: BSD
Conflicts: python-amaranth, python-nmigen
Provides: python-amaranth, python-nmigen
Replaces: python-nmigen-git
Submitter: xiretza
Maintainer: xiretza
Last Packager: xiretza
Votes: 3
Popularity: 0.39
First Submitted: 2021-12-29 10:01 (UTC)
Last Updated: 2022-04-24 07:48 (UTC)

Required by (12)

Sources (1)

Latest Comments

Auerhuhn commented on 2024-06-09 18:48 (UTC)

Hi @xiretza,

In addition to the pdm_build.py patch proposed by @salfter, would you mind adding python-jschon to your depends, and python-packaging and python-pdm-backend to your makedepends?

Without those entries, python-amaranth-git fails to build in a clean chroot.

Regards
Claudia (aka Auerhuhn)

salfter commented on 2024-06-03 20:47 (UTC)

I've forked this repo:

https://aur.archlinux.org/packages/python-amaranth

It grabs the most recent release (currently v0.4.5) and builds it. It adds a git checkout to the prepare() function, and applies the patch I posted below.

salfter commented on 2024-06-03 19:32 (UTC) (edited on 2024-06-03 19:44 (UTC) by salfter)

FWIW, I maintain a Gentoo ebuild for this package. When upstream switched over to PDM, I found I had to patch pdm_build.py as follows:

--- a/pdm_build.py      2023-12-13 01:29:50.000000000 -0800
+++ a/pdm_build.py      2023-12-15 23:07:54.051989617 -0800
@@ -1,13 +1,13 @@
-from pdm.backend._vendor.packaging.version import Version
+#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}"
+    #version = Version(context.config.metadata["version"])
+    #if version.is_prerelease:
+    #    url_version = "latest"
+    #else:
+    url_version = f"v0.4.5"
     context.config.metadata["urls"]["Documentation"] += url_version

Note that (1) I'm building from release tarballs instead of Git master and (2) url_version needs to be set to the actual version you're building. Whether this is applicable or not to the Arch PKGBUILD, I'm not certain. I might try my hand at knocking together a release-version PKGBUILD to see if it makes any difference.

Correction: my ebuild pulls from Git, but it uses the commit corresponding to the release. (Specifically, it uses git-r3.eclass and sets EGIT_COMMIT and EGIT_BRANCH as well as EGIT_REPO_URI.) If I remember right, I had trouble building from the release tarballs for some reason.

=sci-electronics/amaranth-0.4.5::salfter builds against =dev-python/pdm-backend-2.2.1::gentoo without error. I've noticed that the version of pdm-backend Arch is installing is 2.3.0. I keyworded pdm-backend to ~amd64 and rebuilt both pdm-backend (2.3.0) and amaranth without error, so it doesn't appear to be a matter of breakage between pdm-backend versions.

m42uko commented on 2024-04-20 07:58 (UTC)

On my my system, this fails with

==> Starting build()...
* Getting build dependencies for wheel...
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pdm/backend/__init__.py", line 22, in get_requires_for_build_wheel
    with WheelBuilder(Path.cwd(), config_settings) as builder:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pdm/backend/wheel.py", line 78, in __init__
    super().__init__(location, config_settings)
  File "/usr/lib/python3.11/site-packages/pdm/backend/base.py", line 101, in __init__
    self._hooks = list(self.get_hooks())
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pdm/backend/base.py", line 126, in get_hooks
    BuildHookInterface, import_module_at_path(self.location / local_hook)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pdm/backend/utils.py", line 220, in import_module_at_path
    spec.loader.exec_module(module)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/builduser/.cache/yay/python-amaranth-git/src/amaranth/pdm_build.py", line 3, in <module>
    from pdm.backend.hooks.version import SCMVersion
ImportError: cannot import name 'SCMVersion' from 'pdm.backend.hooks.version' (/usr/lib/python3.11/site-packages/pdm/backend/hooks/version/__init__.py)

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Maybe the Arch upstream of python-pdm is too old? Alternatively, we can consider working around this in the PKGBUILD by patching $srcdir/amaranth/pyproject.toml to remove the version_format = "pdm_build:format_version" and deleting src/amaranth/pdm_build.py. I'll leave this decision up to you as I am not inherently familiar with this project (or python build systems for that matter).

xiretza commented on 2022-04-24 07:58 (UTC)

python-amaranth-boards-git is now packaged: https://aur.archlinux.org/packages/python-amaranth-boards-git

xiretza commented on 2022-04-24 07:33 (UTC)

Tests exist to tell you when something is wrong, simply not running them can hardly be considered a "fix" ;) Anyway, the issue is that amaranth targets the latest available yosys, so I changed the depends to reflect that.

amstan commented on 2022-04-24 07:32 (UTC) (edited on 2022-04-24 07:33 (UTC) by amstan)

We're also missing amaranth_boards, which without it's kind of hard to build anything real. I'm making do by just installing python-nmigen-boards (which seems happy "linking" to this package), but that uses the old style imports:

>>> from amaranth import *
>>> from nmigen_boards.mister import *

amstan commented on 2022-04-24 06:14 (UTC) (edited on 2022-04-24 06:14 (UTC) by amstan)

The check() fails for me. I guess there's some failures in the upstream tests:

FAILED tests/test_lib_coding.py::GrayCoderTestCase::test_distance - AssertionError: Formal verification failed:
FAILED tests/test_lib_coding.py::GrayCoderTestCase::test_reversible - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_async - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_async_buffered - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_buffered_pot - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_buffered_potm1 - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_buffered_potp1 - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_fwft_npot - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_fwft_pot - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_not_fwft_npot - AssertionError: Formal verification failed:
FAILED tests/test_lib_fifo.py::FIFOFormalCase::test_sync_not_fwft_pot - AssertionError: Formal verification failed:

I fixed it (for myself, though YMMV) by telling pikaur to tell makepkg to not run check(): --mflags=--nocheck

FWIW I don't think this should be changed in the PKGBUILD, you might still want to run tests, idk what the philosophy of check() is normally.