at 23.11-beta 1.9 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, setuptools 6, setuptools-scm 7, cocotb-bus 8, find-libpython 9, pytestCheckHook 10, swig 11, verilog 12, ghdl 13}: 14 15buildPythonPackage rec { 16 pname = "cocotb"; 17 version = "1.8.1"; 18 19 # pypi source doesn't include tests 20 src = fetchFromGitHub { 21 owner = "cocotb"; 22 repo = "cocotb"; 23 rev = "refs/tags/v${version}"; 24 hash = "sha256-B7SePM8muEL3KFVOY7+OAgQVIRvTs6k29xASK9lgCB4="; 25 }; 26 27 nativeBuildInputs = [ setuptools-scm ]; 28 29 buildInputs = [ setuptools ]; 30 propagatedBuildInputs = [ find-libpython ]; 31 32 postPatch = '' 33 patchShebangs bin/*.py 34 35 # POSIX portability (TODO: upstream this) 36 for f in \ 37 cocotb/share/makefiles/Makefile.* \ 38 cocotb/share/makefiles/simulators/Makefile.* 39 do 40 substituteInPlace $f --replace 'shell which' 'shell command -v' 41 done 42 43 # remove circular dependency cocotb-bus from setup.py 44 substituteInPlace setup.py --replace "'cocotb-bus<1.0'" "" 45 '' + lib.optionalString stdenv.isDarwin '' 46 # disable lto on darwin 47 # https://github.com/NixOS/nixpkgs/issues/19098 48 substituteInPlace cocotb_build_libs.py --replace "-flto" "" 49 ''; 50 51 patches = [ 52 # Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error 53 ./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch 54 ]; 55 56 nativeCheckInputs = [ cocotb-bus pytestCheckHook swig verilog ghdl ]; 57 preCheck = '' 58 export PATH=$out/bin:$PATH 59 mv cocotb cocotb.hidden 60 ''; 61 62 pythonImportsCheck = [ "cocotb" ]; 63 64 meta = with lib; { 65 changelog = "https://github.com/cocotb/cocotb/releases/tag/v${version}"; 66 description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python"; 67 homepage = "https://github.com/cocotb/cocotb"; 68 license = licenses.bsd3; 69 maintainers = with maintainers; [ matthuszagh jleightcap ]; 70 }; 71}