From 805576cd9ba841be85066569c3bae7165402855c Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 1 Sep 2023 13:53:40 -0400 Subject: [PATCH 1/5] python3Packages.argon2-cffi: remove unnecessary cffi dependencies argon2-cffi-bindings needs cffi at build time and run time, therefore it has cffi in nativeBuildInputs and propagatedBuildInputs. argon2-cffi doesn't directly use cffi, only transitively through argon2-cffi-bindings. This also removes a problematic usage of propagatedNativeBuildInputs. Also, add pythonImportsCheck to verify that we have all the necessary dependencies. --- .../python-modules/argon2-cffi-bindings/default.nix | 1 + .../python-modules/argon2-cffi/default.nix | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/argon2-cffi-bindings/default.nix b/pkgs/development/python-modules/argon2-cffi-bindings/default.nix index 3f1f3f86666c..1dc4337e26e6 100644 --- a/pkgs/development/python-modules/argon2-cffi-bindings/default.nix +++ b/pkgs/development/python-modules/argon2-cffi-bindings/default.nix @@ -16,6 +16,7 @@ buildPythonPackage rec { nativeBuildInputs = [ setuptools-scm + cffi ]; propagatedBuildInputs = [ diff --git a/pkgs/development/python-modules/argon2-cffi/default.nix b/pkgs/development/python-modules/argon2-cffi/default.nix index 2282a06e5c64..0521efc444cd 100644 --- a/pkgs/development/python-modules/argon2-cffi/default.nix +++ b/pkgs/development/python-modules/argon2-cffi/default.nix @@ -1,5 +1,4 @@ -{ cffi -, six +{ six , enum34 , hypothesis , pytest @@ -27,14 +26,9 @@ buildPythonPackage rec { flit-core ]; - propagatedBuildInputs = [ cffi six argon2-cffi-bindings ] + propagatedBuildInputs = [ six argon2-cffi-bindings ] ++ lib.optional (!isPy3k) enum34; - propagatedNativeBuildInputs = [ - argon2-cffi-bindings - cffi - ]; - ARGON2_CFFI_USE_SSE2 = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) "0"; nativeCheckInputs = [ hypothesis pytest wheel ]; @@ -42,6 +36,8 @@ buildPythonPackage rec { pytest tests ''; + pythonImportsCheck = [ "argon2" ]; + meta = with lib; { description = "Secure Password Hashes for Python"; homepage = "https://argon2-cffi.readthedocs.io/"; From b55e27cc5c8f71e6f80a8011b36c8383a2087eca Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 1 Sep 2023 13:57:33 -0400 Subject: [PATCH 2/5] python3Packages.argon2-cffi-bindings: use system libargon2 argon2-cffi-bindings uses a vendored copy of libargon2 by default, but can be configured to use a system installation. This reduces the output size avoids issues with the build system mistakenly trying to use SSE2 on non-x86 platforms when cross-compiling. --- .../python-modules/argon2-cffi-bindings/default.nix | 5 +++++ pkgs/development/python-modules/argon2-cffi/default.nix | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/argon2-cffi-bindings/default.nix b/pkgs/development/python-modules/argon2-cffi-bindings/default.nix index 1dc4337e26e6..77182cbd6a43 100644 --- a/pkgs/development/python-modules/argon2-cffi-bindings/default.nix +++ b/pkgs/development/python-modules/argon2-cffi-bindings/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, libargon2 , cffi , setuptools-scm }: @@ -14,6 +15,8 @@ buildPythonPackage rec { sha256 = "bb89ceffa6c791807d1305ceb77dbfacc5aa499891d2c55661c6459651fc39e3"; }; + buildInputs = [ libargon2 ]; + nativeBuildInputs = [ setuptools-scm cffi @@ -23,6 +26,8 @@ buildPythonPackage rec { cffi ]; + env.ARGON2_CFFI_USE_SYSTEM = 1; + # tarball doesn't include tests, but the upstream tests are minimal doCheck = false; pythonImportsCheck = [ "_argon2_cffi_bindings" ]; diff --git a/pkgs/development/python-modules/argon2-cffi/default.nix b/pkgs/development/python-modules/argon2-cffi/default.nix index 0521efc444cd..9d59b5fbad65 100644 --- a/pkgs/development/python-modules/argon2-cffi/default.nix +++ b/pkgs/development/python-modules/argon2-cffi/default.nix @@ -29,8 +29,6 @@ buildPythonPackage rec { propagatedBuildInputs = [ six argon2-cffi-bindings ] ++ lib.optional (!isPy3k) enum34; - ARGON2_CFFI_USE_SSE2 = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) "0"; - nativeCheckInputs = [ hypothesis pytest wheel ]; checkPhase = '' pytest tests From cfce6560db86b1690477b8e769084ceab55c0d66 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 1 Sep 2023 14:01:49 -0400 Subject: [PATCH 3/5] python3Packages.argon2-cffi: remove Python 2 dependencies Remove six and enum34 dependencies that are no longer needed because argon2-cffi doesn't support Python 2. Also, remove the wheel test dependency, which doesn't appear to be required anymore. --- .../python-modules/argon2-cffi/default.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/argon2-cffi/default.nix b/pkgs/development/python-modules/argon2-cffi/default.nix index 9d59b5fbad65..d3c1d28ae7e5 100644 --- a/pkgs/development/python-modules/argon2-cffi/default.nix +++ b/pkgs/development/python-modules/argon2-cffi/default.nix @@ -1,12 +1,8 @@ -{ six -, enum34 -, hypothesis +{ hypothesis , pytest -, wheel , buildPythonPackage , fetchPypi , flit-core -, isPy3k , lib , stdenv , argon2-cffi-bindings @@ -26,10 +22,9 @@ buildPythonPackage rec { flit-core ]; - propagatedBuildInputs = [ six argon2-cffi-bindings ] - ++ lib.optional (!isPy3k) enum34; + propagatedBuildInputs = [ argon2-cffi-bindings ]; - nativeCheckInputs = [ hypothesis pytest wheel ]; + nativeCheckInputs = [ hypothesis pytest ]; checkPhase = '' pytest tests ''; From 1068053205f6fec8be64d5f45781f51977537fc1 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 1 Sep 2023 14:18:21 -0400 Subject: [PATCH 4/5] python3Packages.argon2-cffi: 21.3.0 -> 23.1.0 Upstream has switched from flit to hatch. --- .../python-modules/argon2-cffi/default.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/argon2-cffi/default.nix b/pkgs/development/python-modules/argon2-cffi/default.nix index d3c1d28ae7e5..7b7446641b4b 100644 --- a/pkgs/development/python-modules/argon2-cffi/default.nix +++ b/pkgs/development/python-modules/argon2-cffi/default.nix @@ -2,25 +2,25 @@ , pytest , buildPythonPackage , fetchPypi -, flit-core , lib -, stdenv +, hatchling +, hatch-vcs +, hatch-fancy-pypi-readme , argon2-cffi-bindings }: buildPythonPackage rec { pname = "argon2-cffi"; - version = "21.3.0"; + version = "23.1.0"; format = "pyproject"; src = fetchPypi { - inherit pname version; - sha256 = "d384164d944190a7dd7ef22c6aa3ff197da12962bd04b17f64d4e93d934dba5b"; + pname = "argon2_cffi"; + inherit version; + hash = "sha256-h5w+eaJynOdo67fTbUYJ46eKTKLsOp8SKGygV+PQ2wg="; }; - nativeBuildInputs = [ - flit-core - ]; + nativeBuildInputs = [ hatchling hatch-vcs hatch-fancy-pypi-readme ]; propagatedBuildInputs = [ argon2-cffi-bindings ]; From adf495d55f131c11ae0c31a52154138836332258 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 1 Sep 2023 22:45:22 -0400 Subject: [PATCH 5/5] python3Packages.argon2-cffi: use pytestCheckHook --- pkgs/development/python-modules/argon2-cffi/default.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/argon2-cffi/default.nix b/pkgs/development/python-modules/argon2-cffi/default.nix index 7b7446641b4b..da9022c93f19 100644 --- a/pkgs/development/python-modules/argon2-cffi/default.nix +++ b/pkgs/development/python-modules/argon2-cffi/default.nix @@ -1,5 +1,5 @@ { hypothesis -, pytest +, pytestCheckHook , buildPythonPackage , fetchPypi , lib @@ -24,10 +24,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ argon2-cffi-bindings ]; - nativeCheckInputs = [ hypothesis pytest ]; - checkPhase = '' - pytest tests - ''; + nativeCheckInputs = [ hypothesis pytestCheckHook ]; pythonImportsCheck = [ "argon2" ];