From 4ffce96ac96aaa5ec7b72f6edf0193f5578bbeb9 Mon Sep 17 00:00:00 2001 From: clement Date: Wed, 27 Nov 2024 10:09:15 +0100 Subject: [PATCH] pythonPackages.pygerber: init at 2.4.2 --- .../python-modules/pygerber/default.nix | 91 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 93 insertions(+) create mode 100644 pkgs/development/python-modules/pygerber/default.nix diff --git a/pkgs/development/python-modules/pygerber/default.nix b/pkgs/development/python-modules/pygerber/default.nix new file mode 100644 index 0000000000000..586ad7a6516ef --- /dev/null +++ b/pkgs/development/python-modules/pygerber/default.nix @@ -0,0 +1,91 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + + # build-system + poetry-core, + + # dependencies + numpy, + click, + pillow, + pydantic, + pyparsing, + typing-extensions, + tzlocal, + + # optional dependencies + pygls, + lsprotocol, + drawsvg, + pygments, + shapely, + +}: + +let + pillow_10_4 = pillow.overrideAttrs (prev: { + version = "10.4.0"; + src = fetchFromGitHub { + owner = "python-pillow"; + repo = "pillow"; + rev = "refs/tags/10.4.0"; + hash = "sha256-Q3yvFyJf4gFaVY9X4PlgCE2rU1l9NEXkHBaNZfoHhvU="; + }; + }); + +in +buildPythonPackage rec { + pname = "pygerber"; + version = "2.4.2"; + format = "pyproject"; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "Argmaster"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-+s89tHNTNP+0VMilfDczbOBG/e3DuUBu0113US69KKM="; + }; + + nativeBuildInputs = [ poetry-core ]; + propagatedBuildInputs = [ + numpy + click + pillow_10_4 + pydantic + pyparsing + typing-extensions + tzlocal + ]; + + passthru.optional-dependencies = { + language_server = [ + pygls + lsprotocol + ]; + svg = [ drawsvg ]; + pygments = [ pygments ]; + shapely = [ shapely ]; + all = [ + pygls + lsprotocol + drawsvg + pygments + shapely + ]; + }; + + pythonImportsCheck = [ "pygerber" ]; + + meta = { + description = "PyGerber is a Python implementation of Gerber X3/X2 format. It is based on Ucamco's The Gerber Layer Format Specification."; + homepage = "https://github.com/Argmaster/pygerber"; + changelog = "https://argmaster.github.io/pygerber/stable/Changelog.html"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ clemjvdm ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7a1259039077f..a40797520cf26 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10414,6 +10414,8 @@ self: super: with self; { pygelf = callPackage ../development/python-modules/pygelf { }; + pygerber = callPackage ../development/python-modules/pygerber { }; + pygments-style-github = callPackage ../development/python-modules/pygments-style-github { }; pygnmi = callPackage ../development/python-modules/pygnmi { };