mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-12-04 03:40:18 +00:00
Since the changes to the gnat bootstrap, the system now successfully builds
GHDL, the only dependency of cocotb that was making it fail on darwin
(cherry picked from commit 5125dd0c9b)
95 lines
2.2 KiB
Nix
95 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
setuptools,
|
|
setuptools-scm,
|
|
python,
|
|
cocotb-bus,
|
|
find-libpython,
|
|
ipython,
|
|
pexpect,
|
|
pytestCheckHook,
|
|
swig,
|
|
iverilog,
|
|
ghdl,
|
|
stdenv,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "cocotb";
|
|
version = "2.1.0";
|
|
format = "setuptools";
|
|
|
|
# pypi source doesn't include tests
|
|
src = fetchFromGitHub {
|
|
owner = "cocotb";
|
|
repo = "cocotb";
|
|
tag = "v${version}";
|
|
hash = "sha256-MND6d+5ymlGT597kt6rWN9ylmoGvexIylzsgjY0NRe8=";
|
|
};
|
|
|
|
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'" ""
|
|
'';
|
|
|
|
# cocotb uses dlopen so that it's dynamic libraries are python version agnostic.
|
|
# Here we patch its dynamic libraries to make sure the correct libpython is found and used.
|
|
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
for lib in $out/lib/python*/site-packages/cocotb/libs/*.so; do
|
|
patchelf --add-rpath ${python}/lib --add-needed libpython3.so $lib
|
|
done
|
|
'';
|
|
|
|
disabledTests = [
|
|
# https://github.com/cocotb/cocotb/commit/425e1edb8e7133f4a891f2f87552aa2748cd8d2c#diff-4df986cbc2b1a3f22172caea94f959d8fcb4a128105979e6e99c68139469960cL33
|
|
"test_cocotb"
|
|
"test_cocotb_parallel"
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
cocotb-bus
|
|
ipython
|
|
pexpect
|
|
pytestCheckHook
|
|
swig
|
|
iverilog
|
|
ghdl
|
|
];
|
|
|
|
preCheck = ''
|
|
export PATH=$out/bin:$PATH
|
|
'';
|
|
|
|
pythonImportsCheck = [ "cocotb" ];
|
|
|
|
meta = {
|
|
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 = lib.licenses.bsd3;
|
|
maintainers = with lib.maintainers; [
|
|
matthuszagh
|
|
jleightcap
|
|
evanwporter
|
|
];
|
|
};
|
|
}
|