nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, setuptools
6, setuptools-scm
7, cocotb-bus
8, pytestCheckHook
9, swig
10, verilog
11}:
12
13buildPythonPackage rec {
14 pname = "cocotb";
15 version = "1.6.2";
16
17 # - we need to use the tarball from PyPi
18 # or the full git checkout (with .git)
19 # - using fetchFromGitHub will cause a build failure,
20 # because it does not include required metadata
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "sha256-SY+1727DbWMg6CnmHw8k/VP0dwBRYszn+YyyvZXgvUs=";
24 };
25
26 nativeBuildInputs = [ setuptools-scm ];
27
28 buildInputs = [ setuptools ];
29
30 postPatch = ''
31 patchShebangs bin/*.py
32
33 # POSIX portability (TODO: upstream this)
34 for f in \
35 cocotb/share/makefiles/Makefile.* \
36 cocotb/share/makefiles/simulators/Makefile.*
37 do
38 substituteInPlace $f --replace 'shell which' 'shell command -v'
39 done
40
41 # remove circular dependency cocotb-bus from setup.py
42 substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
43 '';
44
45 checkInputs = [ cocotb-bus pytestCheckHook swig verilog ];
46
47 checkPhase = ''
48 export PATH=$out/bin:$PATH
49 '';
50
51 meta = with lib; {
52 description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
53 homepage = "https://github.com/cocotb/cocotb";
54 license = licenses.bsd3;
55 maintainers = with maintainers; [ matthuszagh ];
56 broken = stdenv.isDarwin;
57 };
58}