@@ -0,0 +1,43 @@
1+{ stdenv, buildPythonPackage, fetchFromGitHub, setuptools, swig, verilog }:
2+
3+buildPythonPackage rec {
4+ pname = "cocotb";
5+ version = "1.2.0";
6+
7+ src = fetchFromGitHub {
8+ owner = pname;
9+ repo = pname;
10+ rev = "v${version}";
11+ sha256 = "091q63jcm87xggqgqi44lw2vjxhl1v4yl0mv2c76hgavb29w4w5y";
12+ };
13+
14+ propagatedBuildInputs = [
15+ setuptools
16+ ];
17+
18+ postPatch = ''
19+ patchShebangs bin/*.py
20+
21+ # POSIX portability (TODO: upstream this)
22+ for f in \
23+ cocotb/share/makefiles/Makefile.* \
24+ cocotb/share/makefiles/simulators/Makefile.*
25+ do
26+ substituteInPlace $f --replace 'shell which' 'shell command -v'
27+ done
28+ '';
29+
30+ checkInputs = [ swig verilog ];
31+
32+ checkPhase = ''
33+ export PATH=$out/bin:$PATH
34+ make test
35+ '';
36+
37+ meta = with stdenv.lib; {
38+ description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
39+ homepage = https://github.com/cocotb/cocotb;
40+ license = licenses.bsd3;
41+ maintainers = with maintainers; [ matthuszagh ];
42+ };
43+}