summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyverilog/default.nix
blob: 02bfa9ff45d58a51ea24cfcc6bb27116888a2477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  jinja2,
  ply,
  iverilog,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "pyverilog";
  version = "1.3.0";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    sha256 = "1a74k8r21swmfwvgv4c014y6nbcyl229fspxw89ygsgb0j83xnar";
  };

  patchPhase = ''
    # The path to Icarus can still be overridden via an environment variable at runtime.
    substituteInPlace pyverilog/vparser/preprocessor.py \
      --replace-fail \
        "iverilog = 'iverilog'" \
        "iverilog = '${lib.getExe' iverilog "iverilog"}'"
  '';

  build-system = [ setuptools ];

  dependencies = [
    jinja2
    ply
    iverilog
  ];

  preCheck = ''
    substituteInPlace pytest.ini \
      --replace-fail "python_paths" "pythonpath"
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    homepage = "https://github.com/PyHDI/Pyverilog";
    description = "Python-based Hardware Design Processing Toolkit for Verilog HDL";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ trepetti ];
  };
}