2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
cocotb-bus,
|
|
|
|
find-libpython,
|
|
|
|
pytestCheckHook,
|
|
|
|
swig,
|
|
|
|
verilog,
|
|
|
|
ghdl,
|
2021-05-28 09:39:13 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cocotb";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "1.8.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
# pypi source doesn't include tests
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cocotb";
|
|
|
|
repo = "cocotb";
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-B7SePM8muEL3KFVOY7+OAgQVIRvTs6k29xASK9lgCB4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
nativeBuildInputs = [ setuptools-scm ];
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
buildInputs = [ setuptools ];
|
|
|
|
propagatedBuildInputs = [ find-libpython ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postPatch =
|
|
|
|
''
|
|
|
|
patchShebangs bin/*.py
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# 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
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# 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" ""
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
patches = [
|
|
|
|
# Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error
|
|
|
|
./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
# 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
|
2022-06-26 10:26:21 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
cocotb-bus
|
|
|
|
pytestCheckHook
|
|
|
|
swig
|
|
|
|
verilog
|
|
|
|
ghdl
|
|
|
|
];
|
2022-09-22 12:36:57 +00:00
|
|
|
preCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export PATH=$out/bin:$PATH
|
2022-09-22 12:36:57 +00:00
|
|
|
mv cocotb cocotb.hidden
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
pythonImportsCheck = [ "cocotb" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-08-10 07:59:29 +00:00
|
|
|
changelog = "https://github.com/cocotb/cocotb/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "cocotb-config";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/cocotb/cocotb";
|
|
|
|
license = licenses.bsd3;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
matthuszagh
|
|
|
|
jleightcap
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|