1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 setuptools,
7 jinja2,
8 ply,
9 iverilog,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "pyverilog";
15 version = "1.3.0";
16 pyproject = true;
17
18 src = fetchPypi {
19 inherit pname version;
20 sha256 = "1a74k8r21swmfwvgv4c014y6nbcyl229fspxw89ygsgb0j83xnar";
21 };
22
23 disabled = pythonOlder "3.7";
24
25 patchPhase = ''
26 # The path to Icarus can still be overridden via an environment variable at runtime.
27 substituteInPlace pyverilog/vparser/preprocessor.py \
28 --replace-fail \
29 "iverilog = 'iverilog'" \
30 "iverilog = '${lib.getExe' iverilog "iverilog"}'"
31 '';
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 jinja2
37 ply
38 iverilog
39 ];
40
41 preCheck = ''
42 substituteInPlace pytest.ini \
43 --replace-fail "python_paths" "pythonpath"
44 '';
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 meta = with lib; {
49 homepage = "https://github.com/PyHDI/Pyverilog";
50 description = "Python-based Hardware Design Processing Toolkit for Verilog HDL";
51 license = licenses.asl20;
52 maintainers = with maintainers; [ trepetti ];
53 };
54}