nixpkgs/pkgs/development/python-modules/cocotb/default.nix

59 lines
1.4 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, setuptools
, setuptools-scm
, cocotb-bus
2021-12-08 06:31:20 +00:00
, pytestCheckHook
, swig
, verilog
}:
2019-10-17 15:24:02 +01:00
buildPythonPackage rec {
pname = "cocotb";
version = "1.6.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 = "sha256-SY+1727DbWMg6CnmHw8k/VP0dwBRYszn+YyyvZXgvUs=";
2019-10-17 15:24:02 +01:00
};
nativeBuildInputs = [ setuptools-scm ];
buildInputs = [ setuptools ];
2019-10-17 15:24:02 +01: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
# remove circular dependency cocotb-bus from setup.py
substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
2019-10-17 15:24:02 +01:00
'';
2021-12-08 06:31:20 +00:00
checkInputs = [ cocotb-bus pytestCheckHook swig verilog ];
2019-10-17 15:24:02 +01:00
checkPhase = ''
export PATH=$out/bin:$PATH
'';
meta = with lib; {
2019-10-17 15:24:02 +01:00
description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
homepage = "https://github.com/cocotb/cocotb";
2019-10-17 15:24:02 +01:00
license = licenses.bsd3;
maintainers = with maintainers; [ matthuszagh ];
broken = stdenv.isDarwin;
2019-10-17 15:24:02 +01:00
};
}