at master 1.2 kB view raw
1{ 2 fetchFromGitHub, 3 buildPythonPackage, 4 pillow, 5 numpy, 6 libdmtx, 7 lib, 8}: 9 10buildPythonPackage rec { 11 pname = "pylibdmtx"; 12 version = "0.1.11"; 13 format = "setuptools"; 14 15 src = fetchFromGitHub { 16 owner = "NaturalHistoryMuseum"; 17 repo = "pylibdmtx"; 18 rev = "v${version}"; 19 hash = "sha256-HSHh80iRCbDM/eihepEzY7KCLAfgTSZS3PP1Q9JFNPo="; 20 }; 21 22 # Change: 23 # def load(): 24 # """Loads the libdmtx shared library. 25 # 26 # To: 27 # def load(): 28 # return cdll.LoadLibrary("/nix/store/.../lib/libdmtx.so") 29 # """Loads the libdmtx shared library. 30 postPatch = '' 31 sed -i '\#def load.*#a\ return cdll.LoadLibrary("${libdmtx}/lib/libdmtx.so")' \ 32 pylibdmtx/dmtx_library.py 33 34 # Checks that the loader works in various scenarios, but we just 35 # forced it to only work one way. 36 rm pylibdmtx/tests/test_dmtx_library.py 37 ''; 38 39 propagatedBuildInputs = [ 40 pillow 41 numpy 42 ]; 43 44 pythonImportsCheck = [ "pylibdmtx" ]; 45 46 meta = with lib; { 47 description = "Read and write Data Matrix barcodes from Python 2 and 3 using the libdmtx library"; 48 homepage = "https://github.com/NaturalHistoryMuseum/pylibdmtx/"; 49 license = licenses.mit; 50 maintainers = with maintainers; [ grahamc ]; 51 }; 52}