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