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