From 8baabeae4aac4c2ecadbd71cf537e8393fc229af Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Wed, 17 Sep 2025 14:54:37 +0200 Subject: [PATCH 1/2] python3Packages.cryptolyzer: fix directories exclude from python package * correctly exclude submodules directory * also exclude docs directory --- .../python-modules/cryptolyzer/default.nix | 5 ++++ .../cryptolyzer/fix-dirs-exclude.patch | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/python-modules/cryptolyzer/fix-dirs-exclude.patch diff --git a/pkgs/development/python-modules/cryptolyzer/default.nix b/pkgs/development/python-modules/cryptolyzer/default.nix index f9ae2daca9a8..917990075ff0 100644 --- a/pkgs/development/python-modules/cryptolyzer/default.nix +++ b/pkgs/development/python-modules/cryptolyzer/default.nix @@ -30,6 +30,11 @@ buildPythonPackage rec { hash = "sha256-rRiRaXONLMNirKsK+QZWMSvaGeSLrHN9BpM8dhxoaxY="; }; + patches = [ + # https://gitlab.com/coroner/cryptolyzer/-/merge_requests/4 + ./fix-dirs-exclude.patch + ]; + pythonRemoveDeps = [ "bs4" ]; build-system = [ diff --git a/pkgs/development/python-modules/cryptolyzer/fix-dirs-exclude.patch b/pkgs/development/python-modules/cryptolyzer/fix-dirs-exclude.patch new file mode 100644 index 000000000000..0455c892b993 --- /dev/null +++ b/pkgs/development/python-modules/cryptolyzer/fix-dirs-exclude.patch @@ -0,0 +1,27 @@ +From 5ba89bc0bcc23fc7e8cd3eefb2d78b5a63f4fc66 Mon Sep 17 00:00:00 2001 +From: Ivan Mincik +Date: Wed, 17 Sep 2025 14:44:15 +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 96a0fa89..a26ee257 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -106,7 +106,7 @@ technical_name = 'cryptolyzer' + license-files = ['LICENSE.txt'] + + [tool.setuptools.packages.find] +-exclude = ['submodules'] ++exclude = ['submodules*', 'docs'] + + [tool.tox] + envlist = [ +-- +GitLab + From ed45aa092a079672a2decb6718553c0bcdedb897 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Wed, 17 Sep 2025 14:56:07 +0200 Subject: [PATCH 2/2] python3Packages.cryptolyzer: remove python bytecode from package Remove `__pycache__` directories: ``` ./result/lib/python3.13/site-packages/tools/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/common/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/dnsrec/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/hassh/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/ssh/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/tls/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/ja3/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/httpx/__pycache__ ./result/lib/python3.13/site-packages/cryptolyzer/__pycache__ ``` --- pkgs/development/python-modules/cryptolyzer/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/python-modules/cryptolyzer/default.nix b/pkgs/development/python-modules/cryptolyzer/default.nix index 917990075ff0..c927696f8e90 100644 --- a/pkgs/development/python-modules/cryptolyzer/default.nix +++ b/pkgs/development/python-modules/cryptolyzer/default.nix @@ -59,6 +59,14 @@ buildPythonPackage rec { # Tests require networking doCheck = false; + 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 = [ "cryptolyzer" ]; meta = {