From a9cca8bfcb483a8c271ad32f20dc5d6fb069379b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 10 Apr 2024 12:22:30 +0200 Subject: [PATCH 1/2] python312Packages.credstash: refactor --- .../python-modules/credstash/default.nix | 55 +++++++++++++++---- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/credstash/default.nix b/pkgs/development/python-modules/credstash/default.nix index 8ed90b65f7a2..0838c218d6fa 100644 --- a/pkgs/development/python-modules/credstash/default.nix +++ b/pkgs/development/python-modules/credstash/default.nix @@ -1,19 +1,36 @@ -{ lib, buildPythonPackage, fetchPypi, cryptography, boto3, pyyaml, docutils, pytest, fetchpatch }: +{ lib +, boto3 +, buildPythonPackage +, cryptography +, docutils +, fetchFromGitHub +, fetchpatch +, pytestCheckHook +, pythonOlder +, pyyaml +, setuptools +}: buildPythonPackage rec { pname = "credstash"; version = "1.17.1"; - format = "setuptools"; + pyproject = true; - src = fetchPypi { - inherit pname version; - sha256 = "6c04e8734ef556ab459018da142dd0b244093ef176b3be5583e582e9a797a120"; + disabled = pythonOlder "3.7"; + + + src = fetchFromGitHub { + owner = "fugue"; + repo = "credstash"; + rev = "refs/tags/v${version}"; + hash = "sha256-a6OzffGt5piHgi0AWEXJED0R/+8RETh/9hYJi/lUVu0="; }; patches = [ + # setup_requires -> tests_requires for pytest (fetchpatch { url = "https://github.com/fugue/credstash/commit/9c02ee43ed6e37596cafbca2fe80c532ec19d2d8.patch"; - sha256 = "dlybrpfLK+PqwWWhH9iXgXHYysZGmcZAFGWNOwsG0xA="; + hash = "sha256-dlybrpfLK+PqwWWhH9iXgXHYysZGmcZAFGWNOwsG0xA="; }) ]; # The install phase puts an executable and a copy of the library it imports in @@ -24,17 +41,33 @@ buildPythonPackage rec { # file ensures that Python imports the module from site-packages library. postInstall = "rm $out/bin/credstash.py"; - nativeBuildInputs = [ pytest ]; + build-system = [ + setuptools + ]; - propagatedBuildInputs = [ cryptography boto3 pyyaml docutils ]; + dependencies = [ + boto3 + cryptography + docutils + pyyaml + ]; - # No tests in archive - doCheck = false; + nativeBuildInputs = [ + pytestCheckHook + ]; + + disabledTestPaths = [ + # Tests require a region + "integration_tests/test_credstash_lib.py" + "tests/key_service_test.py" + ]; meta = with lib; { description = "A utility for managing secrets in the cloud using AWS KMS and DynamoDB"; - mainProgram = "credstash"; homepage = "https://github.com/LuminalOSS/credstash"; + changelog = "https://github.com/fugue/credstash/releases/tag/v${version}"; license = licenses.asl20; + maintainers = with maintainers; [ ]; + mainProgram = "credstash"; }; } From 52f123b158a0f4c5d25123f366b1e8a3c606f4f4 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 10 Apr 2024 12:22:49 +0200 Subject: [PATCH 2/2] python312Packages.credstash: format with nixfmt --- .../python-modules/credstash/default.nix | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/credstash/default.nix b/pkgs/development/python-modules/credstash/default.nix index 0838c218d6fa..dd950001c3d0 100644 --- a/pkgs/development/python-modules/credstash/default.nix +++ b/pkgs/development/python-modules/credstash/default.nix @@ -1,14 +1,15 @@ -{ lib -, boto3 -, buildPythonPackage -, cryptography -, docutils -, fetchFromGitHub -, fetchpatch -, pytestCheckHook -, pythonOlder -, pyyaml -, setuptools +{ + lib, + boto3, + buildPythonPackage, + cryptography, + docutils, + fetchFromGitHub, + fetchpatch, + pytestCheckHook, + pythonOlder, + pyyaml, + setuptools, }: buildPythonPackage rec { @@ -18,7 +19,6 @@ buildPythonPackage rec { disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "fugue"; repo = "credstash"; @@ -41,9 +41,7 @@ buildPythonPackage rec { # file ensures that Python imports the module from site-packages library. postInstall = "rm $out/bin/credstash.py"; - build-system = [ - setuptools - ]; + build-system = [ setuptools ]; dependencies = [ boto3 @@ -52,9 +50,7 @@ buildPythonPackage rec { pyyaml ]; - nativeBuildInputs = [ - pytestCheckHook - ]; + nativeBuildInputs = [ pytestCheckHook ]; disabledTestPaths = [ # Tests require a region