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 format = "setuptools";
22 disabled = pythonOlder "3.6";
23
24 src = fetchPypi {
25 pname = "PySpice";
26 inherit version;
27 sha256 = "d28448accad98959e0f5932af8736e90a1f3f9ff965121c6881d24cdfca23d22";
28 };
29
30 propagatedBuildInputs = [
31 setuptools
32 requests
33 pyyaml
34 cffi
35 matplotlib
36 numpy
37 ply
38 scipy
39 libngspice
40 ];
41
42 doCheck = false;
43 pythonImportsCheck = [ "PySpice" ];
44
45 postPatch = ''
46 substituteInPlace PySpice/Spice/NgSpice/Shared.py --replace \
47 "ffi.dlopen(self.library_path)" \
48 "ffi.dlopen('${libngspice}/lib/libngspice${stdenv.hostPlatform.extensions.sharedLibrary}')"
49 '';
50
51 meta = with lib; {
52 description = "Simulate electronic circuit using Python and the Ngspice / Xyce simulators";
53 homepage = "https://github.com/FabriceSalvaire/PySpice";
54 license = licenses.gpl3Only;
55 maintainers = with maintainers; [ matthuszagh ];
56 };
57}