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