1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 setuptools, 7 setuptools-scm, 8 9 pillow, 10 qrcode, 11 python-barcode, 12 six, 13 appdirs, 14 pyyaml, 15 argcomplete, 16 importlib-resources, 17 18 pyusb, 19 pyserial, 20 pycups, 21 22 jaconv, 23 pytestCheckHook, 24 pytest-mock, 25 scripttest, 26 mock, 27 hypothesis, 28}: 29 30buildPythonPackage rec { 31 pname = "python-escpos"; 32 version = "3.1"; 33 pyproject = true; 34 35 src = fetchFromGitHub { 36 owner = "python-escpos"; 37 repo = "python-escpos"; 38 tag = "v${version}"; 39 hash = "sha256-f7qA1+8PwnXS526jjULEoyn0ejnvsneuWDt863p4J2g="; 40 fetchSubmodules = true; 41 }; 42 43 build-system = [ 44 setuptools 45 setuptools-scm 46 ]; 47 48 dependencies = [ 49 pillow 50 qrcode 51 python-barcode 52 six 53 appdirs 54 pyyaml 55 argcomplete 56 importlib-resources 57 ]; 58 59 optional-dependencies = { 60 usb = [ pyusb ]; 61 serial = [ pyserial ]; 62 cups = [ pycups ]; 63 all = [ 64 pyusb 65 pyserial 66 pycups 67 ]; 68 }; 69 70 preCheck = '' 71 # force the tests to use the module in $out 72 rm -r src 73 74 # disable checking coverage 75 substituteInPlace pyproject.toml \ 76 --replace-fail "--cov escpos --cov-report=xml" "" 77 78 # allow tests to find the cli executable 79 export PATH="$out/bin:$PATH" 80 ''; 81 82 nativeCheckInputs = [ 83 jaconv 84 pytestCheckHook 85 pytest-mock 86 scripttest 87 mock 88 hypothesis 89 ] ++ optional-dependencies.all; 90 91 pythonImportsCheck = [ "escpos" ]; 92 93 meta = { 94 changelog = "https://github.com/python-escpos/python-escpos/blob/${src.rev}/CHANGELOG.rst"; 95 description = "Python library to manipulate ESC/POS printers"; 96 homepage = "https://python-escpos.readthedocs.io/"; 97 license = lib.licenses.mit; 98 mainProgram = "python-escpos"; 99 maintainers = with lib.maintainers; [ tomasajt ]; 100 }; 101}