diff --git a/pkgs/by-name/pa/parsedmarc/package.nix b/pkgs/by-name/pa/parsedmarc/package.nix index f6b38bf7d3c3..0f28ef5ec02b 100644 --- a/pkgs/by-name/pa/parsedmarc/package.nix +++ b/pkgs/by-name/pa/parsedmarc/package.nix @@ -1,44 +1,7 @@ { - python3, + python3Packages, fetchFromGitHub, }: -let - python = python3.override { - self = python; - packageOverrides = self: super: { - # https://github.com/domainaware/parsedmarc/issues/464 - msgraph-core = super.msgraph-core.overridePythonAttrs (old: rec { - version = "0.2.2"; - - src = fetchFromGitHub { - owner = "microsoftgraph"; - repo = "msgraph-sdk-python-core"; - rev = "v${version}"; - hash = "sha256-eRRlG3GJX3WeKTNJVWgNTTHY56qiUGOlxtvEZ2xObLA="; - }; - - nativeBuildInputs = with self; [ - flit-core - ]; - - propagatedBuildInputs = with self; [ - requests - ]; - - nativeCheckInputs = with self; [ - pytestCheckHook - responses - ]; - - disabledTestPaths = [ - "tests/integration" - ]; - - pythonImportsCheck = [ "msgraph.core" ]; - }); - }; - }; -in -with python.pkgs; +with python3Packages; toPythonApplication parsedmarc diff --git a/pkgs/development/python-modules/mail-parser/default.nix b/pkgs/development/python-modules/mail-parser/default.nix index c56abff52667..4a9958b594dd 100644 --- a/pkgs/development/python-modules/mail-parser/default.nix +++ b/pkgs/development/python-modules/mail-parser/default.nix @@ -2,58 +2,56 @@ lib, buildPythonPackage, python, - glibcLocales, + extract-msg, fetchFromGitHub, + hatchling, pytest-cov-stub, + pytest-mock, pytestCheckHook, - setuptools, - six, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "mail-parser"; - version = "4.1.4"; + version = "4.4.0"; pyproject = true; src = fetchFromGitHub { owner = "SpamScope"; repo = "mail-parser"; - tag = version; - hash = "sha256-wwLUD/k26utugK/Yx9eXYEdSOvrk0Cy6RkXGDnzZ+fE="; + tag = finalAttrs.version; + hash = "sha256-fuL2cWQSkYQKhG/UVNOp4ch4MrZINizvsPCQUzb3Z9c="; }; - env.LC_ALL = "en_US.utf-8"; + build-system = [ hatchling ]; - nativeBuildInputs = [ glibcLocales ]; - - build-system = [ setuptools ]; - - pythonRemoveDeps = [ "ipaddress" ]; - - dependencies = [ - six - ]; + optional-dependencies = { + outlook = [ extract-msg ]; + }; pythonImportsCheck = [ "mailparser" ]; nativeCheckInputs = [ pytest-cov-stub + pytest-mock pytestCheckHook - ]; + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; - # Taken from .travis.yml + # Taken from .github/workflows/main.yml postCheck = '' ${python.interpreter} -m mailparser -v ${python.interpreter} -m mailparser -h ${python.interpreter} -m mailparser -f tests/mails/mail_malformed_3 -j + ${python.interpreter} -m mailparser -f tests/mails/mail_outlook_1 -j cat tests/mails/mail_malformed_3 | ${python.interpreter} -m mailparser -k -j ''; meta = { + changelog = "https://github.com/SpamScope/mail-parser/releases/tag/${finalAttrs.src.tag}"; description = "Mail parser for python 2 and 3"; - mainProgram = "mailparser"; + mainProgram = "mail-parser"; homepage = "https://github.com/SpamScope/mail-parser"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ psyanticy ]; }; -} +}) diff --git a/pkgs/development/python-modules/mailsuite/default.nix b/pkgs/development/python-modules/mailsuite/default.nix index c402453f7e42..71203068559e 100644 --- a/pkgs/development/python-modules/mailsuite/default.nix +++ b/pkgs/development/python-modules/mailsuite/default.nix @@ -1,24 +1,35 @@ { lib, + azure-identity, + authres, buildPythonPackage, + cryptography, + dkimpy, dnspython, expiringdict, - fetchPypi, + fetchFromGitHub, + google-api-python-client, + google-auth, + google-auth-oauthlib, hatchling, html2text, imapclient, mail-parser, + msgraph-sdk, publicsuffix2, + pytestCheckHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "mailsuite"; - version = "1.11.2"; + version = "2.2.2"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-ilcOH27lVKhh/xFO/dkWZkwtx6wPYrKTWR3n1xqoUdk="; + src = fetchFromGitHub { + owner = "seanthegeek"; + repo = "mailsuite"; + tag = finalAttrs.version; + hash = "sha256-qQ+AaelLQED0mWCAItx/3d7o9QVUnhUVxvdCfnNRqzQ="; }; pythonRelaxDeps = [ "mail-parser" ]; @@ -26,6 +37,9 @@ buildPythonPackage rec { build-system = [ hatchling ]; dependencies = [ + authres + cryptography + dkimpy dnspython expiringdict html2text @@ -34,16 +48,30 @@ buildPythonPackage rec { publicsuffix2 ]; + optional-dependencies = { + all = lib.concatAttrValues (lib.removeAttrs finalAttrs.passthru.optional-dependencies [ "all" ]); + gmail = [ + google-api-python-client + google-auth + google-auth-oauthlib + ]; + msgraph = [ + azure-identity + msgraph-sdk + ]; + }; + pythonImportsCheck = [ "mailsuite" ]; - # Module has no tests - doCheck = false; + nativeCheckInputs = [ + pytestCheckHook + ]; meta = { description = "Python package to simplify receiving, parsing, and sending email"; homepage = "https://seanthegeek.github.io/mailsuite/"; - changelog = "https://github.com/seanthegeek/mailsuite/blob/master/CHANGELOG.md"; + changelog = "https://github.com/seanthegeek/mailsuite/blob/${finalAttrs.src.tag}/CHANGELOG.md"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ talyz ]; }; -} +}) diff --git a/pkgs/development/python-modules/parsedmarc/default.nix b/pkgs/development/python-modules/parsedmarc/default.nix index 32d457b1596f..4d6b37a7baa6 100644 --- a/pkgs/development/python-modules/parsedmarc/default.nix +++ b/pkgs/development/python-modules/parsedmarc/default.nix @@ -16,17 +16,10 @@ elasticsearch-dsl, elasticsearch, expiringdict, - geoip2, - google-api-core, - google-api-python-client, - google-auth-httplib2, - google-auth-oauthlib, - google-auth, - imapclient, - kafka-python-ng, + kafka-python, lxml, mailsuite, - msgraph-core, + maxminddb, nixosTests, opensearch-py, publicsuffixlist, @@ -38,7 +31,7 @@ xmltodict, # test - unittestCheckHook, + pytestCheckHook, }: let @@ -49,14 +42,14 @@ let in buildPythonPackage rec { pname = "parsedmarc"; - version = "9.6.0"; + version = "10.1.1"; pyproject = true; src = fetchFromGitHub { owner = "domainaware"; repo = "parsedmarc"; tag = version; - hash = "sha256-ez7QMFsSvJzxhfCPA4G6oGQhqAzcgKBTJMiMogIJvNg="; + hash = "sha256-dFwlcbR8NNKrDBoKPDX9M82tTK5aCbeP3KMF/BctgMc="; }; postPatch = '' @@ -82,17 +75,10 @@ buildPythonPackage rec { elasticsearch elasticsearch-dsl expiringdict - geoip2 - google-api-core - google-api-python-client - google-auth - google-auth-httplib2 - google-auth-oauthlib - imapclient - kafka-python-ng + kafka-python lxml mailsuite - msgraph-core + maxminddb opensearch-py publicsuffixlist pygelf @@ -101,10 +87,17 @@ buildPythonPackage rec { tqdm urllib3 xmltodict - ]; + ] + ++ mailsuite.optional-dependencies.gmail + ++ mailsuite.optional-dependencies.msgraph; nativeCheckInputs = [ - unittestCheckHook + pytestCheckHook + ]; + + disabledTests = [ + # contacts DNS servers at 1.1.1.1 and 8.8.8.8 + "test_general_dns_settings_with_defaults" ]; pythonImportsCheck = [ "parsedmarc" ]; @@ -121,7 +114,5 @@ buildPythonPackage rec { license = lib.licenses.asl20; maintainers = with lib.maintainers; [ talyz ]; mainProgram = "parsedmarc"; - # https://github.com/domainaware/parsedmarc/issues/464 - broken = lib.versionAtLeast msgraph-core.version "1.0.0"; }; }