about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFabian Affolter <fabian@affolter-engineering.ch>2024-04-23 13:14:36 +0200
committerGitHub <noreply@github.com>2024-04-23 13:14:36 +0200
commit51dfb8a9c7a9464b20ccf04fe81cb0d0171ef463 (patch)
treec1563dfecfe72ac503de9ec901bb3d509a1056d7
parentf505639614c71d3dee7dc9713d6b02a3f294f24e (diff)
parentf747fb392392211fbecec1b28078e609002dcfc8 (diff)
Merge pull request #306196 from fabaff/timecop-refactor
python312Packages.timecop: refactor, python312Packages.onetimepass: refactor
-rw-r--r--pkgs/development/python-modules/onetimepass/default.nix29
-rw-r--r--pkgs/development/python-modules/timecop/default.nix21
-rw-r--r--pkgs/tools/admin/awslimitchecker/default.nix44
3 files changed, 61 insertions, 33 deletions
diff --git a/pkgs/development/python-modules/onetimepass/default.nix b/pkgs/development/python-modules/onetimepass/default.nix
index 3bea443a36f2..dde4983c2afe 100644
--- a/pkgs/development/python-modules/onetimepass/default.nix
+++ b/pkgs/development/python-modules/onetimepass/default.nix
@@ -1,23 +1,35 @@
-{ lib, buildPythonPackage, fetchFromGitHub, six, timecop }:
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitHub,
+  pythonOlder,
+  setuptools,
+  six,
+  timecop,
+  unittestCheckHook,
+}:
 
 buildPythonPackage rec {
   pname = "onetimepass";
   version = "1.0.1";
-  format = "setuptools";
+  pyproject = true;
+
+  disabled = pythonOlder "3.7";
 
   src = fetchFromGitHub {
     owner = "tadeck";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "0wmv62l3r8r4428gdzyj80lhgadfqvj220khz1wnm9alyzg60wkh";
+    repo = "onetimepass";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-cHJg3vdUpWp5+HACIeTGrqkHKUDS//aQICSjPKgwu3I=";
   };
 
-  propagatedBuildInputs = [
-    six
-  ];
+  build-system = [ setuptools ];
+
+  dependencies = [ six ];
 
   nativeCheckInputs = [
     timecop
+    unittestCheckHook
   ];
 
   pythonImportsCheck = [ "onetimepass" ];
@@ -25,6 +37,7 @@ buildPythonPackage rec {
   meta = with lib; {
     description = "One-time password library for HMAC-based (HOTP) and time-based (TOTP) passwords";
     homepage = "https://github.com/tadeck/onetimepass";
+    changelog = "https://github.com/tadeck/onetimepass/releases/tag/v${version}";
     license = licenses.mit;
     maintainers = with maintainers; [ zakame ];
   };
diff --git a/pkgs/development/python-modules/timecop/default.nix b/pkgs/development/python-modules/timecop/default.nix
index fb455d079b0e..443b609fb4c4 100644
--- a/pkgs/development/python-modules/timecop/default.nix
+++ b/pkgs/development/python-modules/timecop/default.nix
@@ -1,20 +1,35 @@
-{ lib, buildPythonPackage, fetchPypi }:
+{
+  lib,
+  buildPythonPackage,
+  fetchPypi,
+  pythonOlder,
+  setuptools,
+  unittestCheckHook,
+}:
 
 buildPythonPackage rec {
   pname = "timecop";
   version = "0.5.0dev";
-  format = "setuptools";
+  pyproject = true;
+
+  disabled = pythonOlder "3.7";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0zbi58sw2yp1qchzfhyi7bsrwxajiypphg65fir98kvj03g011wd";
+    hash = "sha256-jYcA3gByT5RydMU8eK+PUnWe9TrRQ/chw+F6wTUqcX0=";
   };
 
+  build-system = [ setuptools ];
+
+  nativeCheckInputs = [ unittestCheckHook ];
+
   # test_epoch fails, see https://github.com/bluekelp/pytimecop/issues/4
   preCheck = ''
     sed -i 's/test_epoch/_test_epoch/' timecop/tests/test_freeze.py
   '';
 
+  pythonImportsCheck = [ "timecop" ];
+
   meta = with lib; {
     description = "A port of the most excellent TimeCop Ruby Gem for Python";
     homepage = "https://github.com/bluekelp/pytimecop";
diff --git a/pkgs/tools/admin/awslimitchecker/default.nix b/pkgs/tools/admin/awslimitchecker/default.nix
index 548bf69e6f07..760a6f1e67d0 100644
--- a/pkgs/tools/admin/awslimitchecker/default.nix
+++ b/pkgs/tools/admin/awslimitchecker/default.nix
@@ -1,17 +1,29 @@
-{ lib, python3Packages, fetchFromGitHub }:
+{
+  lib,
+  fetchFromGitHub,
+  python3,
+}:
 
-python3Packages.buildPythonApplication rec {
+python3.pkgs.buildPythonApplication rec {
   pname = "awslimitchecker";
   version = "12.0.0";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "jantman";
     repo = "awslimitchecker";
-    rev = version;
-    sha256 = "1p6n4kziyl6sfq7vgga9v88ddwh3sgnfb1m1cx6q25n0wyl7phgv";
+    rev = "refs/tags/${version}";
+    hash = "sha256-+8F7qOfAFoFNZ6GG5ezTA/LWENpJvbcPdtpQH/8k1tw=";
   };
 
-  propagatedBuildInputs = with python3Packages; [
+  patches = [
+    # Fix the version lookup to use only the hardcoded version in the source package
+    ./version.patch
+  ];
+
+  build-system = with python3.pkgs; [ setuptools ];
+
+  dependencies = with python3.pkgs; [
     boto3
     botocore
     pytz
@@ -19,27 +31,15 @@ python3Packages.buildPythonApplication rec {
     versionfinder
   ];
 
-  nativeCheckInputs = with python3Packages; [
+  nativeCheckInputs = with python3.pkgs; [
     freezegun
     onetimepass
-    pytestCheckHook
     pyotp
+    mock
+    (pytestCheckHook.override { pytest = pytest_7; })
     testfixtures
   ];
 
-  patches = [
-    # Fix the version lookup to use only the hardcoded version in the source package
-    ./version.patch
-  ];
-
-  pytestFlagsArray = [
-    "awslimitchecker/tests"
-
-    # Upstream did not adapt to pytest 8 yet.
-    "-W"
-    "ignore::pytest.PytestRemovedIn8Warning"
-  ];
-
   disabledTestPaths = [
     # AWS tests that use the network
     "awslimitchecker/tests/services"
@@ -53,11 +53,11 @@ python3Packages.buildPythonApplication rec {
   pythonImportsCheck = [ "awslimitchecker.checker" ];
 
   meta = with lib; {
+    description = "A script and python package to check your AWS service limits and usage via boto3";
     homepage = "http://awslimitchecker.readthedocs.org";
     changelog = "https://github.com/jantman/awslimitchecker/blob/${version}/CHANGES.rst";
-    description = "A script and python package to check your AWS service limits and usage via boto3";
-    mainProgram = "awslimitchecker";
     license = licenses.agpl3Plus;
     maintainers = with maintainers; [ zakame ];
+    mainProgram = "awslimitchecker";
   };
 }