summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyspice/default.nix
blob: e5915c23ab4e5266456b6094dcda3ac391e38d92 (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
52
53
54
55
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  libngspice,
  numpy,
  ply,
  scipy,
  pyyaml,
  cffi,
  requests,
  matplotlib,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pyspice";
  version = "1.5";
  format = "setuptools";

  src = fetchPypi {
    pname = "PySpice";
    inherit version;
    sha256 = "d28448accad98959e0f5932af8736e90a1f3f9ff965121c6881d24cdfca23d22";
  };

  propagatedBuildInputs = [
    setuptools
    requests
    pyyaml
    cffi
    matplotlib
    numpy
    ply
    scipy
    libngspice
  ];

  doCheck = false;
  pythonImportsCheck = [ "PySpice" ];

  postPatch = ''
    substituteInPlace PySpice/Spice/NgSpice/Shared.py --replace \
        "ffi.dlopen(self.library_path)" \
        "ffi.dlopen('${libngspice}/lib/libngspice${stdenv.hostPlatform.extensions.sharedLibrary}')"
  '';

  meta = {
    description = "Simulate electronic circuit using Python and the Ngspice / Xyce simulators";
    homepage = "https://github.com/FabriceSalvaire/PySpice";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ matthuszagh ];
  };
}