about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyspice/default.nix
blob: 0119c38099ccb600639987e31b72a11fdbcbbe79 (plain) (blame)
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
{ lib, stdenv
, buildPythonPackage
, pythonOlder
, fetchPypi
, libngspice
, numpy
, ply
, scipy
, pyyaml
, cffi
, requests
, matplotlib
, setuptools
}:

buildPythonPackage rec {
  pname = "PySpice";
  version = "1.5";
  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname 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 = with lib; {
    description = "Simulate electronic circuit using Python and the Ngspice / Xyce simulators";
    homepage = "https://github.com/FabriceSalvaire/PySpice";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ matthuszagh ];
  };
}