@@ -1,19 +1,31 @@
1−{ lib, stdenv, buildPythonPackage, fetchFromGitHub, setuptools, swig, verilog }:
1+{ lib
2+, stdenv
3+, buildPythonPackage
4+, fetchPypi
5+, setuptools
6+, setuptools-scm
7+, cocotb-bus
8+, pytest
9+, swig
10+, verilog
11+}:
212
313buildPythonPackage rec {
414 pname = "cocotb";
5− version = "1.5.1";
6−
7− src = fetchFromGitHub {
8− owner = pname;
9− repo = pname;
10− rev = "v${version}";
11− sha256 = "02bw2i03vd4rcvdk10qdjl2lbvvy81cn9qpr8vzq8cm9h45689mv";
15+ version = "1.5.2";
16+
17+ # - we need to use the tarball from PyPi
18+ # or the full git checkout (with .git)
19+ # - using fetchFromGitHub will cause a build failure,
20+ # because it does not include required metadata
21+ src = fetchPypi {
22+ inherit pname version;
23+ sha256 = "9f4f3e6eb9caeb479e98d604770645b57469cd25b39e28df1916ffcd593efbe6";
1224 };
1325
14− propagatedBuildInputs = [
15− setuptools
16− ];
26+ nativeBuildInputs = [ setuptools-scm ];
27+
28+ buildInputs = [ setuptools ];
1729
1830 postPatch = ''
1931 patchShebangs bin/*.py
@@ -25,16 +37,14 @@ buildPythonPackage rec {
2537 do
2638 substituteInPlace $f --replace 'shell which' 'shell command -v'
2739 done
40+
41+ # remove circular dependency cocotb-bus from setup.py
42+ substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
2843 '';
2944
30− checkInputs = [ swig verilog ];
45+ checkInputs = [ cocotb-bus pytest swig verilog ];
3146
3247 checkPhase = ''
33− # test expected failures actually pass because of a fix in our icarus version
34− # https://github.com/cocotb/cocotb/issues/1952
35− substituteInPlace tests/test_cases/test_discovery/test_discovery.py \
36− --replace 'def access_single_bit' $'def foo(x): pass\ndef foo'
37−
3848 export PATH=$out/bin:$PATH
3949 make test
4050 '';