diff --git a/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch b/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch new file mode 100644 index 000000000000..d3c32cf96407 --- /dev/null +++ b/pkgs/applications/misc/cobang/0001-Poetry-core-and-pillow-9.patch @@ -0,0 +1,31 @@ +From 324a267b0e5505c9124874581bc48fb174fb2542 Mon Sep 17 00:00:00 2001 +From: "P. R. d. O" +Date: Fri, 4 Mar 2022 07:03:17 -0600 +Subject: [PATCH] Pillow update + +--- + pyproject.toml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 5dc25e0..b3ba397 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -11,7 +11,7 @@ readme = "README.rst" + [tool.poetry.dependencies] + python = "^3.7" + logbook = "^1.5.3" +-Pillow = "^8.2.0" ++Pillow = "^9.0.0" + requests = "^2.24.0" + kiss-headers = "^2.2.3" + single-version = "^1.5.1" +@@ -33,4 +33,4 @@ skip-string-normalization = true + + [build-system] + requires = ["poetry>=0.12"] +-build-backend = "poetry.masonry.api" ++build-backend = "poetry.core.masonry.api" +-- +2.35.1 + diff --git a/pkgs/applications/misc/cobang/default.nix b/pkgs/applications/misc/cobang/default.nix new file mode 100644 index 000000000000..1401a7a8df28 --- /dev/null +++ b/pkgs/applications/misc/cobang/default.nix @@ -0,0 +1,102 @@ +{ lib +, buildPythonApplication +, fetchFromGitHub +, wrapGAppsHook +, atk +, gdk-pixbuf +, gobject-introspection +, gtk3 +, gst-plugins-good +, libhandy +, librsvg +, networkmanager +, pango +, gst-python +, kiss-headers +, Logbook +, pillow +, poetry-core +, pygobject3 +, python +, python-zbar +, requests +, single-version +, pytestCheckHook }: + +buildPythonApplication rec { + pname = "cobang"; + version = "0.9.6"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "hongquan"; + repo = "CoBang"; + rev = "v${version}"; + sha256 = "sha256-YcXQ2wAgFSsJEqcaDQotpX1put4pQaF511kwq/c2yHw="; + }; + + patches = [ + ./0001-Poetry-core-and-pillow-9.patch + ]; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook + ]; + + propagatedBuildInputs = [ + gst-python + kiss-headers + Logbook + pillow + poetry-core + pygobject3 + python-zbar + requests + single-version + ]; + + buildInputs = [ + atk + gdk-pixbuf + # Needed to detect namespaces + gobject-introspection + gst-plugins-good + libhandy + networkmanager + pango + ]; + + checkInputs = [ + pytestCheckHook + ]; + + # Wrapping this manually for SVG recognition + dontWrapGApps = true; + + postInstall = '' + # Needed by the application + cp -R data $out/${python.sitePackages}/ + + # Icons and applications + install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.svg -t $out/share/pixmaps/ + install -Dm 644 $out/${python.sitePackages}/data/vn.hoabinh.quan.CoBang.desktop -t $out/share/applications/ + substituteInPlace $out/share/applications/vn.hoabinh.quan.CoBang.desktop \ + --replace "Exec=" "Exec=$out/bin/" + ''; + + preFixup = '' + wrapProgram $out/bin/cobang \ + ''${gappsWrapperArgs[@]} \ + --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ + --set GDK_PIXBUF_MODULE_FILE "${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" + ''; + + meta = with lib; { + description = "A QR code scanner desktop app for Linux"; + homepage = "https://github.com/hongquan/CoBang"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ wolfangaukang ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/python-modules/kiss-headers/default.nix b/pkgs/development/python-modules/kiss-headers/default.nix new file mode 100644 index 000000000000..0ceced85cacf --- /dev/null +++ b/pkgs/development/python-modules/kiss-headers/default.nix @@ -0,0 +1,39 @@ +{ lib, buildPythonPackage, fetchFromGitHub, requests, pytestCheckHook }: + +buildPythonPackage rec { + pname = "kiss-headers"; + version = "2.3.0"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "Ousret"; + repo = pname; + rev = version; + sha256 = "sha256-/eTRyxFyAKQMzE/JjdoEN3w0lRiaIJcsJHTWV8M0CYQ="; + }; + + propagatedBuildInputs = [ requests ]; + + checkInputs = [ pytestCheckHook ]; + + postPatch = '' + substituteInPlace setup.cfg \ + --replace "--cov=kiss_headers --doctest-modules --cov-report=term-missing -rxXs" "--doctest-modules -rxXs" + ''; + + disabledTestPaths = [ + # Tests require internet access + "kiss_headers/__init__.py" + "tests/test_serializer.py" + "tests/test_with_http_request.py" + ]; + + pythonImportsCheck = [ "kiss_headers" ]; + + meta = with lib; { + description = "Python package for HTTP/1.1 style headers"; + homepage = "https://github.com/Ousret/kiss-headers"; + license = licenses.mit; + maintainers = with maintainers; [ wolfangaukang ]; + }; +} diff --git a/pkgs/development/python-modules/python-zbar/default.nix b/pkgs/development/python-modules/python-zbar/default.nix new file mode 100644 index 000000000000..04e89b664c49 --- /dev/null +++ b/pkgs/development/python-modules/python-zbar/default.nix @@ -0,0 +1,42 @@ +{ lib , buildPythonPackage , fetchFromGitHub , pillow , zbar , pytestCheckHook }: + +buildPythonPackage rec { + pname = "python-zbar"; + version = "0.23.90"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "mchehab"; + repo = "zbar"; + rev = version; + sha256 = "sha256-FvV7TMc4JbOiRjWLka0IhtpGGqGm5fis7h870OmJw2U="; + }; + + propagatedBuildInputs = [ pillow ]; + + buildInputs = [ zbar ]; + + checkInputs = [ pytestCheckHook ]; + + preBuild = '' + cd python + ''; + + disabledTests = [ + #AssertionError: b'Y800' != 'Y800' + "test_format" + "test_new" + #Requires loading a recording device + #zbar.SystemError: + "test_processing" + ]; + + pythonImportsCheck = [ "zbar" ]; + + meta = with lib; { + description = "Python bindings for zbar"; + homepage = "https://github.com/mchehab/zbar"; + license = licenses.lgpl21Only; + maintainers = with maintainers; [ wolfangaukang ]; + }; +} diff --git a/pkgs/development/python-modules/single-version/0001-set-poetry-core.patch b/pkgs/development/python-modules/single-version/0001-set-poetry-core.patch new file mode 100644 index 000000000000..4c6f869c0c27 --- /dev/null +++ b/pkgs/development/python-modules/single-version/0001-set-poetry-core.patch @@ -0,0 +1,21 @@ +From d949b37151cd538d4c6a15e1ba6c1343f8bff76d Mon Sep 17 00:00:00 2001 +From: "P. R. d. O" +Date: Mon, 6 Dec 2021 15:26:19 -0600 +Subject: [PATCH] set poetry-core + +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index d3fdc52..bd7ddc2 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -27,4 +27,4 @@ black = "^19.10b0" + + [build-system] + requires = ["poetry>=0.12"] +-build-backend = "poetry.masonry.api" ++build-backend = "poetry.core.masonry.api" +-- +2.33.1 diff --git a/pkgs/development/python-modules/single-version/default.nix b/pkgs/development/python-modules/single-version/default.nix new file mode 100644 index 000000000000..39cd92f5f67e --- /dev/null +++ b/pkgs/development/python-modules/single-version/default.nix @@ -0,0 +1,31 @@ +{ lib, buildPythonPackage, fetchFromGitHub, poetry-core, pytestCheckHook }: + +buildPythonPackage rec { + pname = "single-version"; + version = "1.5.1"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "hongquan"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-I8ATQzPRH9FVjqPoqrNjYMBU5azpmkLjRmHcz943C10="; + }; + + patches = [ + ./0001-set-poetry-core.patch + ]; + + nativeBuildInputs = [ poetry-core ]; + + checkInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "single_version" ]; + + meta = with lib; { + description = "Utility to let you have a single source of version in your code base"; + homepage = "https://github.com/hongquan/single-version"; + license = licenses.mit; + maintainers = with maintainers; [ wolfangaukang ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 24785322b0d3..f48203741d52 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4484,6 +4484,10 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) CoreServices; }; + cobang = python3Packages.callPackage ../applications/misc/cobang { + gst-plugins-good = gst_all_1.gst-plugins-good.override { gtkSupport = true; }; + }; + cocoapods = callPackage ../development/mobile/cocoapods { }; cocoapods-beta = lowPrio (callPackage ../development/mobile/cocoapods { beta = true; }); diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 20a757033a18..fbdd25360e61 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4476,6 +4476,8 @@ in { kinparse = callPackage ../development/python-modules/kinparse { }; + kiss-headers = callPackage ../development/python-modules/kiss-headers { }; + kitchen = callPackage ../development/python-modules/kitchen { }; kivy = callPackage ../development/python-modules/kivy { @@ -8275,6 +8277,8 @@ in { python-xmp-toolkit = callPackage ../development/python-modules/python-xmp-toolkit { }; + python-zbar = callPackage ../development/python-modules/python-zbar { }; + pythran = callPackage ../development/python-modules/pythran { inherit (pkgs.llvmPackages) openmp; }; @@ -9194,6 +9198,8 @@ in { simpy = callPackage ../development/python-modules/simpy { }; + single-version = callPackage ../development/python-modules/single-version { }; + signify = callPackage ../development/python-modules/signify { }; siosocks = callPackage ../development/python-modules/siosocks { };