Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 iverilog, 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 50 patches = [ 51 # Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error 52 ./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch 53 54 # For the 1.8.1 release only: remove the test_unicode_handle_assignment_deprecated test 55 # It's more thoroughly removed upstream master with 425e1edb8e7133f4a891f2f87552aa2748cd8d2c 56 ./0002-Patch-remove-test_unicode_handle_assignment_deprecated-test.patch 57 ]; 58 59 nativeCheckInputs = [ 60 cocotb-bus 61 pytestCheckHook 62 swig 63 iverilog 64 ghdl 65 ]; 66 preCheck = '' 67 export PATH=$out/bin:$PATH 68 mv cocotb cocotb.hidden 69 ''; 70 71 pythonImportsCheck = [ "cocotb" ]; 72 73 meta = with lib; { 74 changelog = "https://github.com/cocotb/cocotb/releases/tag/v${version}"; 75 description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python"; 76 mainProgram = "cocotb-config"; 77 homepage = "https://github.com/cocotb/cocotb"; 78 license = licenses.bsd3; 79 maintainers = with maintainers; [ 80 matthuszagh 81 jleightcap 82 ]; 83 }; 84}