c142b7e441
I removed the test as it currently fails on master and is removed upstream in the as-yet-unreleased next version. The test that fails looks like this: ``` Traceback (most recent call last): File "/build/source/tests/test_cases/test_cocotb/test_deprecated.py", line 39, in test_unicode_handle_assignment_deprecated dut.stream_in_string.value = "Bad idea" ^^^^^^^^^^^^^^^^^^^^ File "/nix/store/yvcizx3fwkm044jpw9sfpnb0kx0g2bfl-python3.11-cocotb-1.8.1/lib/python3.11/site-packages/cocotb/handle.py", line 370, in __getattr__ raise AttributeError(f"{self._name} contains no object named {name}") AttributeError: sample_module contains no object named stream_in_string During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/source/tests/test_cases/test_cocotb/test_deprecated.py", line 38, in test_unicode_handle_assignment_deprecated with pytest.warns(DeprecationWarning, match=".*bytes.*"): File "/nix/store/5ipi1f14ji1nrvqnf8h8fqvr0zny183d-python3.11-pytest-8.0.2/lib/python3.11/site-packages/_pytest/recwarn.py", line 332, in __exit__ fail( File "/nix/store/5ipi1f14ji1nrvqnf8h8fqvr0zny183d-python3.11-pytest-8.0.2/lib/python3.11/site-packages/_pytest/outcomes.py", line 188, in fail raise Failed(msg=reason, pytrace=pytrace) Failed: DID NOT WARN. No warnings of type (<class 'DeprecationWarning'>,) were emitted. Emitted warnings: []. ```
78 lines
2.2 KiB
Nix
78 lines
2.2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, setuptools
|
|
, setuptools-scm
|
|
, cocotb-bus
|
|
, find-libpython
|
|
, pytestCheckHook
|
|
, swig
|
|
, verilog
|
|
, ghdl
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "cocotb";
|
|
version = "1.8.1";
|
|
format = "setuptools";
|
|
|
|
# pypi source doesn't include tests
|
|
src = fetchFromGitHub {
|
|
owner = "cocotb";
|
|
repo = "cocotb";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-B7SePM8muEL3KFVOY7+OAgQVIRvTs6k29xASK9lgCB4=";
|
|
};
|
|
|
|
nativeBuildInputs = [ setuptools-scm ];
|
|
|
|
buildInputs = [ setuptools ];
|
|
propagatedBuildInputs = [ find-libpython ];
|
|
|
|
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'" ""
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
# disable lto on darwin
|
|
# https://github.com/NixOS/nixpkgs/issues/19098
|
|
substituteInPlace cocotb_build_libs.py --replace "-flto" ""
|
|
'';
|
|
|
|
patches = [
|
|
# Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error
|
|
./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch
|
|
|
|
# For the 1.8.1 release only: remove the test_unicode_handle_assignment_deprecated test
|
|
# It's more thoroughly removed upstream master with 425e1edb8e7133f4a891f2f87552aa2748cd8d2c
|
|
./0002-Patch-remove-test_unicode_handle_assignment_deprecated-test.patch
|
|
];
|
|
|
|
nativeCheckInputs = [ cocotb-bus pytestCheckHook swig verilog ghdl ];
|
|
preCheck = ''
|
|
export PATH=$out/bin:$PATH
|
|
mv cocotb cocotb.hidden
|
|
'';
|
|
|
|
pythonImportsCheck = [ "cocotb" ];
|
|
|
|
meta = with lib; {
|
|
changelog = "https://github.com/cocotb/cocotb/releases/tag/v${version}";
|
|
description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
|
|
mainProgram = "cocotb-config";
|
|
homepage = "https://github.com/cocotb/cocotb";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ matthuszagh jleightcap ];
|
|
};
|
|
}
|