2021-05-28 09:39:13 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, setuptools
|
|
|
|
, setuptools-scm
|
|
|
|
, cocotb-bus
|
|
|
|
, pytest
|
|
|
|
, swig
|
|
|
|
, verilog
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cocotb";
|
2021-05-28 09:39:13 +00:00
|
|
|
version = "1.5.2";
|
|
|
|
|
|
|
|
# - we need to use the tarball from PyPi
|
|
|
|
# or the full git checkout (with .git)
|
|
|
|
# - using fetchFromGitHub will cause a build failure,
|
|
|
|
# because it does not include required metadata
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
sha256 = "9f4f3e6eb9caeb479e98d604770645b57469cd25b39e28df1916ffcd593efbe6";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
nativeBuildInputs = [ setuptools-scm ];
|
|
|
|
|
|
|
|
buildInputs = [ setuptools ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs bin/*.py
|
|
|
|
|
|
|
|
# POSIX portability (TODO: upstream this)
|
|
|
|
for f in \
|
|
|
|
cocotb/share/makefiles/Makefile.* \
|
|
|
|
cocotb/share/makefiles/simulators/Makefile.*
|
|
|
|
do
|
|
|
|
substituteInPlace $f --replace 'shell which' 'shell command -v'
|
|
|
|
done
|
2021-05-28 09:39:13 +00:00
|
|
|
|
|
|
|
# remove circular dependency cocotb-bus from setup.py
|
|
|
|
substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
checkInputs = [ cocotb-bus pytest swig verilog ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
make test
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
|
|
|
|
homepage = "https://github.com/cocotb/cocotb";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ matthuszagh ];
|
2021-02-13 14:23:35 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|