15 buildPythonPackage rec {
18 format = "setuptools";
20 # pypi source doesn't include tests
21 src = fetchFromGitHub {
24 rev = "refs/tags/v${version}";
25 hash = "sha256-B7SePM8muEL3KFVOY7+OAgQVIRvTs6k29xASK9lgCB4=";
28 nativeBuildInputs = [ setuptools-scm ];
30 buildInputs = [ setuptools ];
31 propagatedBuildInputs = [ find-libpython ];
34 patchShebangs bin/*.py
36 # POSIX portability (TODO: upstream this)
38 cocotb/share/makefiles/Makefile.* \
39 cocotb/share/makefiles/simulators/Makefile.*
41 substituteInPlace $f --replace 'shell which' 'shell command -v'
44 # remove circular dependency cocotb-bus from setup.py
45 substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
46 '' + lib.optionalString stdenv.isDarwin ''
47 # disable lto on darwin
48 # https://github.com/NixOS/nixpkgs/issues/19098
49 substituteInPlace cocotb_build_libs.py --replace "-flto" ""
53 # Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error
54 ./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch
56 # For the 1.8.1 release only: remove the test_unicode_handle_assignment_deprecated test
57 # It's more thoroughly removed upstream master with 425e1edb8e7133f4a891f2f87552aa2748cd8d2c
58 ./0002-Patch-remove-test_unicode_handle_assignment_deprecated-test.patch
61 nativeCheckInputs = [ cocotb-bus pytestCheckHook swig verilog ghdl ];
63 export PATH=$out/bin:$PATH
64 mv cocotb cocotb.hidden
67 pythonImportsCheck = [ "cocotb" ];
70 changelog = "https://github.com/cocotb/cocotb/releases/tag/v${version}";
71 description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
72 mainProgram = "cocotb-config";
73 homepage = "https://github.com/cocotb/cocotb";
74 license = licenses.bsd3;
75 maintainers = with maintainers; [ matthuszagh jleightcap ];