Skip to content

Commit

Permalink
python3Packages.cocotb: fix build (#355818)
Browse files Browse the repository at this point in the history
  • Loading branch information
wegank authored Nov 15, 2024
2 parents b89265d + 8c863fc commit 4f7829a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 76 deletions.

This file was deleted.

This file was deleted.

50 changes: 25 additions & 25 deletions pkgs/development/python-modules/cocotb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,47 @@
swig,
iverilog,
ghdl,
stdenv,
fetchpatch,
}:

buildPythonPackage rec {
pname = "cocotb";
version = "1.9.1";
version = "1.9.2";
format = "setuptools";

# pypi source doesn't include tests
src = fetchFromGitHub {
owner = "cocotb";
repo = "cocotb";
rev = "refs/tags/v${version}";
hash = "sha256-+pS+y9rmyJ4laDK5evAtoqr5D0GuHGaX6DpK1qtumnA=";
hash = "sha256-7KCo7g2I1rfm8QDHRm3ZKloHwjDIICnJCF8KhaFdvqY=";
};

nativeBuildInputs = [ setuptools-scm ];

buildInputs = [ setuptools ];
propagatedBuildInputs = [ find-libpython ];

postPatch =
''
patchShebangs bin/*.py
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
# 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'" ""
'';

patches = [
# Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error
./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch
# remove circular dependency cocotb-bus from setup.py
substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
'';

# 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
disabledTests = [
# https://github.com/cocotb/cocotb/commit/425e1edb8e7133f4a891f2f87552aa2748cd8d2c#diff-4df986cbc2b1a3f22172caea94f959d8fcb4a128105979e6e99c68139469960cL33
"test_cocotb"
"test_cocotb_parallel"
];

nativeCheckInputs = [
Expand All @@ -62,20 +60,22 @@ buildPythonPackage rec {
iverilog
ghdl
];

preCheck = ''
export PATH=$out/bin:$PATH
mv cocotb cocotb.hidden
'';

pythonImportsCheck = [ "cocotb" ];

meta = with lib; {
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 = licenses.bsd3;
maintainers = with maintainers; [
license = lib.licenses.bsd3;
broken = stdenv.hostPlatform.isDarwin;
maintainers = with lib.maintainers; [
matthuszagh
jleightcap
];
Expand Down

0 comments on commit 4f7829a

Please sign in to comment.