From e982a42e483ca2d561142ce5c63057b3186188ed Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sat, 12 Jul 2025 04:18:35 +0200 Subject: [PATCH] rss2email: modernize, move to pkgs/by-name --- .../rs/rss2email/package.nix} | 45 +++++++++++-------- pkgs/top-level/all-packages.nix | 4 -- 2 files changed, 27 insertions(+), 22 deletions(-) rename pkgs/{applications/networking/feedreaders/rss2email/default.nix => by-name/rs/rss2email/package.nix} (66%) diff --git a/pkgs/applications/networking/feedreaders/rss2email/default.nix b/pkgs/by-name/rs/rss2email/package.nix similarity index 66% rename from pkgs/applications/networking/feedreaders/rss2email/default.nix rename to pkgs/by-name/rs/rss2email/package.nix index c13135dbb31b..143a3a9edc56 100644 --- a/pkgs/applications/networking/feedreaders/rss2email/default.nix +++ b/pkgs/by-name/rs/rss2email/package.nix @@ -1,23 +1,15 @@ { lib, - pythonPackages, + python3Packages, fetchPypi, fetchpatch2, nixosTests, }: -with pythonPackages; - -buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "rss2email"; version = "3.14"; - format = "setuptools"; - - propagatedBuildInputs = [ - feedparser - html2text - ]; - nativeCheckInputs = [ beautifulsoup4 ]; + pyproject = true; src = fetchPypi { inherit pname version; @@ -30,6 +22,11 @@ buildPythonApplication rec { url = "https://github.com/rss2email/rss2email/commit/b5c0e78006c2db6929b5ff50e8529de58a00412a.patch"; hash = "sha256-edmsi3I0acx5iF9xoAS9deSexqW2UtWZR/L7CgeZs/M="; }) + (fetchpatch2 { + name = "use-poetry-core.patch"; + url = "https://github.com/rss2email/rss2email/commit/183a17aefe4eb66f898cf088519b1e845559f2bd.patch"; + hash = "sha256-SoWahlOJ7KkaHMwOrKIBgwEz8zJQrSXVD1w2wiV1phE="; + }) ]; outputs = [ @@ -40,10 +37,19 @@ buildPythonApplication rec { postPatch = '' # sendmail executable is called from PATH instead of sbin by default - sed -e 's|/usr/sbin/sendmail|sendmail|' \ - -i rss2email/config.py + substituteInPlace rss2email/config.py \ + --replace-fail '/usr/sbin/sendmail' 'sendmail' ''; + build-system = with python3Packages; [ + poetry-core + ]; + + dependencies = with python3Packages; [ + feedparser + html2text + ]; + postInstall = '' install -Dm 644 r2e.1 $man/share/man/man1/r2e.1 # an alias for better finding the manpage @@ -54,11 +60,14 @@ buildPythonApplication rec { cp AUTHORS COPYING CHANGELOG README.rst $doc/share/doc/rss2email/ ''; - checkPhase = '' - runHook preCheck - env PATH=$out/bin:$PATH python ./test/test.py - runHook postCheck - ''; + nativeCheckInputs = [ + python3Packages.unittestCheckHook + ]; + + unittestFlagsArray = [ + "-s" + "test" + ]; meta = with lib; { description = "Tool that converts RSS/Atom newsfeeds to email"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 286e790df8e3..f714de902e8d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4278,10 +4278,6 @@ with pkgs; rsibreak = libsForQt5.callPackage ../applications/misc/rsibreak { }; - rss2email = callPackage ../applications/networking/feedreaders/rss2email { - pythonPackages = python3Packages; - }; - rucio = callPackage ../by-name/ru/rucio/package.nix { # Pinned to python 3.12 while python313Packages.future does not evaluate and # until https://github.com/CZ-NIC/pyoidc/issues/649 is resolved