Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / cocotb / default.nix
blobec5cbe827768d4c289407e458e1a6c95a8718768
1 { lib, stdenv, buildPythonPackage, fetchFromGitHub, setuptools, swig, verilog }:
3 buildPythonPackage rec {
4   pname = "cocotb";
5   version = "1.4.0";
7   src = fetchFromGitHub {
8     owner = pname;
9     repo = pname;
10     rev = "v${version}";
11     sha256 = "0fv0mg8zh40ffq0q39s195y6hvjrzihpx0i3f7ba5881syw3x7p4";
12   };
14   propagatedBuildInputs = [
15     setuptools
16   ];
18   postPatch = ''
19     patchShebangs bin/*.py
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   '';
30   checkInputs = [ swig verilog ];
32   checkPhase = ''
33     # test expected failures actually pass because of a fix in our icarus version
34     # https://github.com/cocotb/cocotb/issues/1952
35     substituteInPlace tests/test_cases/test_discovery/test_discovery.py \
36       --replace 'def access_single_bit' $'def foo(x): pass\ndef foo'
38     export PATH=$out/bin:$PATH
39     make test
40   '';
42   meta = with lib; {
43     description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
44     homepage = "https://github.com/cocotb/cocotb";
45     license = licenses.bsd3;
46     maintainers = with maintainers; [ matthuszagh ];
47     broken = stdenv.isDarwin;
48   };