[bug#68153,v1] gnu: Add python-cocotb.

Message ID 36ac7f35c88f5faada042376019c603b707db0b1.1740649408.git.csantosb@inventati.org
State New
Headers
Series [bug#68153,v1] gnu: Add python-cocotb. |

Commit Message

Cayetano Santos Feb. 27, 2025, 9:43 a.m. UTC
  * gnu/packages/electronics.scm (python-cocotb): New variable.

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


base-commit: 4270c484ca174ad97d1add91fa5fc69041a6af9d
--
2.48.1
  

Comments

Cayetano Santos Feb. 28, 2025, 3:48 p.m. UTC | #1
Rather send this to guix science, as the testing strongly depends on
ghdl-clang, which belongs there.

    https://codeberg.org/guix-science/guix-science/pulls/85
  

Patch

diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm
index df0238c348..d013012dae 100644
--- a/gnu/packages/electronics.scm
+++ b/gnu/packages/electronics.scm
@@ -6,6 +6,7 @@ 
 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2024 Juliana Sims <juli@incana.org>
+;;; Copyright © 2025, Cayetano Santos <csantosb@inventati.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@  (define-module (gnu packages electronics)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system pyproject)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -42,6 +44,7 @@  (define-module (gnu packages electronics)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages embedded)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages fpga)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages graphviz)
@@ -522,3 +525,34 @@  (define-public minipro
 Additionally your user must be member of the @code{plugdev} group.")
       (home-page "https://gitlab.com/DavidGriffith/minipro")
       (license license:gpl3+))))
+
+(define-public python-cocotb
+  (package
+    (name "python-cocotb")
+    (version "1.9.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/cocotb/cocotb")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "19mybnhqa2jz134jj8686310fniav5nldiq0y7kbgml81ppai87c"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+                      (when tests?
+                        (invoke "make" "-C" "tests")))))))
+    (native-inputs (list python-setuptools python-wheel
+                         ;; tests
+                         python-pytest))
+    (propagated-inputs (list python-find-libpython))
+    (inputs (list iverilog)) ;tests
+    (home-page "https://github.com/cocotb/cocotb")
+    (synopsis "Library for writing HDL testbenches in Python")
+    (description "Coroutine based cosimulation testbench environment for
+verifying VHDL and Verilog RTL using Python.")
+    (license license:bsd-3)))