1{ lib, buildPythonPackage, snap7, fetchFromGitHub, six, setuptools }: 2 3buildPythonPackage rec { 4 pname = "python-snap7"; 5 version = "1.0"; 6 7 src = fetchFromGitHub { 8 owner = "gijzelaerr"; 9 repo = "python-snap7"; 10 rev = version; 11 sha256 = "103drdwf4v3yqvd7sscxx154mmmshb6x19v9yqmkj2lj76m0619s"; 12 }; 13 14 propagatedBuildInputs = [ setuptools six ]; 15 16 prePatch = '' 17 substituteInPlace snap7/common.py \ 18 --replace "lib_location = None" "lib_location = '${snap7}/lib/libsnap7.so'" 19 ''; 20 21 # Tests require root privileges to open privilaged ports 22 # We cannot run them 23 doCheck = false; 24 25 pythonImportsCheck = [ 26 "snap7" 27 "snap7.util" 28 ]; 29 30 meta = with lib; { 31 description = "Python wrapper for the snap7 PLC communication library "; 32 homepage = "https://github.com/gijzelaerr/python-snap7"; 33 license = licenses.mit; 34 maintainers = with maintainers; [ freezeboy ]; 35 }; 36}