From f1966361b6803f5818053f66a5e9e02946f6bb70 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Wed, 17 Sep 2025 14:26:05 +0200 Subject: [PATCH 1/2] python3Packages.cryptoparser: fix directories exclude from python package * correctly exclude submodules directory * also exclude docs directory --- .../python-modules/cryptoparser/default.nix | 5 ++++ .../cryptoparser/fix-dirs-exclude.patch | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/python-modules/cryptoparser/fix-dirs-exclude.patch diff --git a/pkgs/development/python-modules/cryptoparser/default.nix b/pkgs/development/python-modules/cryptoparser/default.nix index 11425b4022ed..ad87757592ee 100644 --- a/pkgs/development/python-modules/cryptoparser/default.nix +++ b/pkgs/development/python-modules/cryptoparser/default.nix @@ -24,6 +24,11 @@ buildPythonPackage rec { hash = "sha256-bEvhMVcm9sXlfhxUD2K4N10nusgxpGYFJQLtJE1/qok="; }; + patches = [ + # https://gitlab.com/coroner/cryptoparser/-/merge_requests/2 + ./fix-dirs-exclude.patch + ]; + build-system = [ setuptools setuptools-scm diff --git a/pkgs/development/python-modules/cryptoparser/fix-dirs-exclude.patch b/pkgs/development/python-modules/cryptoparser/fix-dirs-exclude.patch new file mode 100644 index 000000000000..c667b3b1a8e5 --- /dev/null +++ b/pkgs/development/python-modules/cryptoparser/fix-dirs-exclude.patch @@ -0,0 +1,27 @@ +From 512b5d6e30784594db46bcd0071d63da7065e478 Mon Sep 17 00:00:00 2001 +From: Ivan Mincik +Date: Wed, 17 Sep 2025 14:09:31 +0200 +Subject: [PATCH] Fix directories exclude from package + +* correctly exclude submodules directory +* also exclude docs directory +--- + pyproject.toml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 73897d6..74d43e4 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -75,7 +75,7 @@ technical_name = 'cryptoparser' + license-files = ['LICENSE.txt'] + + [tool.setuptools.packages.find] +-exclude = ['submodules'] ++exclude = ['submodules*', 'docs'] + + [tool.tox] + envlist = [ +-- +GitLab + From 71e5534ac5aad2ca6445e22b906c94106b7d130e Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Wed, 17 Sep 2025 14:28:28 +0200 Subject: [PATCH 2/2] python3Packages.cryptoparser: remove python bytecode from package Remove `__pycache__` directories: ``` ./result/lib/python3.13/site-packages/cryptoparser/common/__pycache__ ./result/lib/python3.13/site-packages/cryptoparser/dnsrec/__pycache__ ./result/lib/python3.13/site-packages/cryptoparser/ssh/__pycache__ ./result/lib/python3.13/site-packages/cryptoparser/tls/__pycache__ ./result/lib/python3.13/site-packages/cryptoparser/httpx/__pycache__ ./result/lib/python3.13/site-packages/cryptoparser/__pycache__ ``` --- pkgs/development/python-modules/cryptoparser/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/python-modules/cryptoparser/default.nix b/pkgs/development/python-modules/cryptoparser/default.nix index ad87757592ee..3535b79d30d1 100644 --- a/pkgs/development/python-modules/cryptoparser/default.nix +++ b/pkgs/development/python-modules/cryptoparser/default.nix @@ -42,6 +42,14 @@ buildPythonPackage rec { urllib3 ]; + postInstall = '' + find $out -name "__pycache__" -type d | xargs rm -rv + + # Prevent creating more binary byte code later (e.g. during + # pythonImportsCheck) + export PYTHONDONTWRITEBYTECODE=1 + ''; + pythonImportsCheck = [ "cryptoparser" ]; meta = with lib; {