diff --git a/pkgs/development/python-modules/python-escpos/default.nix b/pkgs/development/python-modules/python-escpos/default.nix new file mode 100644 index 000000000000..79db35734714 --- /dev/null +++ b/pkgs/development/python-modules/python-escpos/default.nix @@ -0,0 +1,101 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + setuptools, + setuptools-scm, + + pillow, + qrcode, + python-barcode, + six, + appdirs, + pyyaml, + argcomplete, + importlib-resources, + + pyusb, + pyserial, + pycups, + + jaconv, + pytestCheckHook, + pytest-mock, + scripttest, + mock, + hypothesis, +}: + +buildPythonPackage rec { + pname = "python-escpos"; + version = "3.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "python-escpos"; + repo = "python-escpos"; + rev = "refs/tags/v${version}"; + hash = "sha256-f7qA1+8PwnXS526jjULEoyn0ejnvsneuWDt863p4J2g="; + fetchSubmodules = true; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + pillow + qrcode + python-barcode + six + appdirs + pyyaml + argcomplete + importlib-resources + ]; + + optional-dependencies = { + usb = [ pyusb ]; + serial = [ pyserial ]; + cups = [ pycups ]; + all = [ + pyusb + pyserial + pycups + ]; + }; + + preCheck = '' + # force the tests to use the module in $out + rm -r src + + # disable checking coverage + substituteInPlace pyproject.toml \ + --replace-fail "--cov escpos --cov-report=xml" "" + + # allow tests to find the cli executable + export PATH="$out/bin:$PATH" + ''; + + nativeCheckInputs = [ + jaconv + pytestCheckHook + pytest-mock + scripttest + mock + hypothesis + ] ++ optional-dependencies.all; + + pythonImportsCheck = [ "escpos" ]; + + meta = { + changelog = "https://github.com/python-escpos/python-escpos/blob/${src.rev}/CHANGELOG.rst"; + description = "Python library to manipulate ESC/POS printers"; + homepage = "https://python-escpos.readthedocs.io/"; + license = lib.licenses.mit; + mainProgram = "python-escpos"; + maintainers = with lib.maintainers; [ tomasajt ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index aaf2f372f3e3..a92abf715152 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10417,6 +10417,8 @@ self: super: with self; { python-ecobee-api = callPackage ../development/python-modules/python-ecobee-api { }; + python-escpos = callPackage ../development/python-modules/python-escpos { }; + python-ffmpeg = callPackage ../development/python-modules/python-ffmpeg { }; python-flirt = callPackage ../development/python-modules/python-flirt { };