1{ lib, stdenv
2, buildPythonPackage
3, pythonOlder
4, fetchPypi
5, libngspice
6, numpy
7, ply
8, scipy
9, pyyaml
10, cffi
11, requests
12, matplotlib
13, setuptools
14}:
15
16buildPythonPackage rec {
17 pname = "PySpice";
18 version = "1.5";
19 disabled = pythonOlder "3.6";
20
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "d28448accad98959e0f5932af8736e90a1f3f9ff965121c6881d24cdfca23d22";
24 };
25
26 propagatedBuildInputs = [
27 setuptools
28 requests
29 pyyaml
30 cffi
31 matplotlib
32 numpy
33 ply
34 scipy
35 libngspice
36 ];
37
38 doCheck = false;
39 pythonImportsCheck = [ "PySpice" ];
40
41 postPatch = ''
42 substituteInPlace PySpice/Spice/NgSpice/Shared.py --replace \
43 "ffi.dlopen(self.library_path)" \
44 "ffi.dlopen('${libngspice}/lib/libngspice${stdenv.hostPlatform.extensions.sharedLibrary}')"
45 '';
46
47 meta = with lib; {
48 description = "Simulate electronic circuit using Python and the Ngspice / Xyce simulators";
49 homepage = "https://github.com/FabriceSalvaire/PySpice";
50 license = licenses.gpl3Only;
51 maintainers = with maintainers; [ matthuszagh ];
52 };
53}