Subject: [bug#78422] [PATCH electronics-team v3] gnu: Add python-apycula.

From: Cayetano Santos <[email-masked]>
Date: Mon, 19 May 2025 16:16:17 +0200

* gnu/packages/electronics.scm (python-apycula): New variable.

Change-Id: I8e65416c1a555be189e9b8433d1ec7165aee16e9
---
 gnu/packages/electronics.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm
index dc9de79ffa..2736df4b3c 100644
--- a/gnu/packages/electronics.scm
+++ b/gnu/packages/electronics.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages electronics)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system pyproject)
+  #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
@@ -560,6 +561,38 @@ (define-public pulseview
     (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
 for sigrok.")
     (license license:gpl3+)))
+(define-public python-apycula
+  (package
+    (name "python-apycula")
+    (version "0.19")
+    ;; The pypi tar.gz file includes the necessary .pickle files, not available
+    ;; in the home-page repository.
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "Apycula" version))
+       (sha256
+        (base32 "034crnlrb3dlwwc75gpskyz47jvhcv0c3l74z5rpyz622ajv46d6"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f                       ;requires Gowin EDA tools
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Fix error related to import of 'apycula.gowin_bba'.
+          (add-after 'unpack 'sanity-check-fix
+            (lambda _
+              (substitute* "setup.py"
+                (("'gowin_bba")
+                 "# 'gowin_bbva")))))))
+    (propagated-inputs (list python-crc))
+    (native-inputs (list python-setuptools python-wheel))
+    (home-page "https://github.com/YosysHQ/apicula/")
+    (synopsis "Gowin FPGA bitstream format")
+    (description
+     "The project Apycula provides tools to support development and
+generating bitstreams with Gowin FPGAs.")
+    (license license:expat)))
 
 (define-public python-edalize
   (package

base-commit: 450a361532573a02389530a6a80b7821683ed41b
--
2.49.0