about summary refs log tree commit diff
path: root/pkgs/development/python-modules/passlib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/passlib/default.nix')
-rw-r--r--pkgs/development/python-modules/passlib/default.nix61
1 files changed, 37 insertions, 24 deletions
diff --git a/pkgs/development/python-modules/passlib/default.nix b/pkgs/development/python-modules/passlib/default.nix
index cf264c504353..98be7873032a 100644
--- a/pkgs/development/python-modules/passlib/default.nix
+++ b/pkgs/development/python-modules/passlib/default.nix
@@ -1,42 +1,54 @@
-{ lib
-, buildPythonPackage
-, fetchPypi
-, argon2-cffi
-, bcrypt
-, cryptography
-, pytestCheckHook
-, pythonOlder
-, pytest-xdist
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitLab,
+  argon2-cffi,
+  bcrypt,
+  cryptography,
+  pytestCheckHook,
+  pythonOlder,
+  pytest-xdist,
+  setuptools,
 }:
 
 buildPythonPackage rec {
   pname = "passlib";
   version = "1.7.4";
-  format = "setuptools";
+  pyproject = true;
 
   disabled = pythonOlder "3.7";
 
-  src = fetchPypi {
-    inherit pname version;
-    hash = "sha256-3v1Q9ytlxUAqssVzgwppeOXyAq0NmEeTyN3ixBUuvgQ";
+  src = fetchFromGitLab {
+    domain = "foss.heptapod.net";
+    owner = "python-libs";
+    repo = "passlib";
+    rev = "refs/tags/${version}";
+    hash = "sha256-Mx2Xg/KAEfvfep2B/gWATTiAPJc+f22MTcsEdRpt3n8=";
   };
 
-  passthru.optional-dependencies = {
+  build-system = [ setuptools ];
+
+  dependencies = [ setuptools ];
+
+  optional-dependencies = {
     argon2 = [ argon2-cffi ];
     bcrypt = [ bcrypt ];
     totp = [ cryptography ];
   };
 
+  # Fix for https://foss.heptapod.net/python-libs/passlib/-/issues/190
+  postPatch = ''
+    substituteInPlace passlib/handlers/bcrypt.py \
+      --replace-fail "version = _bcrypt.__about__.__version__" \
+      "version = getattr(getattr(_bcrypt, '__about__', _bcrypt), '__version__', '<unknown>')"
+  '';
+
   nativeCheckInputs = [
     pytestCheckHook
     pytest-xdist
-  ] ++ passthru.optional-dependencies.argon2
-  ++ passthru.optional-dependencies.bcrypt
-  ++ passthru.optional-dependencies.totp;
+  ] ++ optional-dependencies.argon2 ++ optional-dependencies.bcrypt ++ optional-dependencies.totp;
 
-  pythonImportsCheck = [
-    "passlib"
-  ];
+  pythonImportsCheck = [ "passlib" ];
 
   disabledTests = [
     # timming sensitive
@@ -53,10 +65,11 @@ buildPythonPackage rec {
     "--deselect=passlib/tests/test_handlers.py::sha256_crypt_os_crypt_test::test_82_crypt_support"
   ];
 
-  meta = with lib; {
-    description = "A password hashing library for Python";
+  meta = {
+    changelog = "https://foss.heptapod.net/python-libs/passlib/-/blob/${version}/docs/history/${lib.versions.majorMinor version}.rst";
+    description = "Password hashing library for Python";
     homepage = "https://foss.heptapod.net/python-libs/passlib";
-    license = licenses.bsdOriginal;
-    maintainers = with maintainers; [ ];
+    license = lib.licenses.bsdOriginal;
+    maintainers = with lib.maintainers; [ dotlambda ];
   };
 }