From 9ec78f5bc16123130c696bee47dd6741b07ac0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 12 Aug 2024 11:14:08 -0700 Subject: [PATCH 1/4] ledger-autosync: fix build with Python 3.12 --- .../office/ledger-autosync/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/applications/office/ledger-autosync/default.nix b/pkgs/applications/office/ledger-autosync/default.nix index 55b89f195e693..6e8f62bbe44ee 100644 --- a/pkgs/applications/office/ledger-autosync/default.nix +++ b/pkgs/applications/office/ledger-autosync/default.nix @@ -1,6 +1,7 @@ { lib , python3Packages , fetchFromGitHub +, fetchpatch2 , ledger , hledger , useLedger ? true @@ -20,6 +21,19 @@ python3Packages.buildPythonApplication rec { sha256 = "0n3y4qxsv1cyvyap95h3rj4bj1sinyfgsajygm7s8di3j5aabqr2"; }; + patches = [ + (fetchpatch2 { + name = "drop-distutils.patch"; + url = "https://github.com/egh/ledger-autosync/commit/b7a2a185b9c3b17764322dcc80153410d12e6a5f.patch"; + hash = "sha256-qKuTpsNFuS00yRAH4VGpMA249ml0BGZsGVb75WrBWEo="; + }) + (fetchpatch2 { + name = "drop-imp.patch"; + url = "https://github.com/egh/ledger-autosync/commit/453d92ad279e6c90fadf835d1c39189a1179eb17.patch"; + hash = "sha256-mncMvdWldAnVDy1+bJ+oyDOrUb14v9LrBRz/CYrtYbc="; + }) + ]; + nativeBuildInputs = with python3Packages; [ poetry-core ]; From d11932af64ccefb18e7810a0feedcc2db6a27141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 12 Aug 2024 11:28:03 -0700 Subject: [PATCH 2/4] ledger-autosync: don't propagate ledger and hledger The one available in $PATH is automatically selected. Also remove other superfluous dependencies. --- .../office/ledger-autosync/default.nix | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/pkgs/applications/office/ledger-autosync/default.nix b/pkgs/applications/office/ledger-autosync/default.nix index 6e8f62bbe44ee..aa1947036186b 100644 --- a/pkgs/applications/office/ledger-autosync/default.nix +++ b/pkgs/applications/office/ledger-autosync/default.nix @@ -4,8 +4,6 @@ , fetchpatch2 , ledger , hledger -, useLedger ? true -, useHledger ? true }: python3Packages.buildPythonApplication rec { @@ -39,31 +37,16 @@ python3Packages.buildPythonApplication rec { ]; propagatedBuildInputs = with python3Packages; [ - asn1crypto - beautifulsoup4 - cffi - cryptography - entrypoints - fuzzywuzzy - idna - jeepney - keyring - lxml - mock - nose ofxclient - ofxhome ofxparse - pbr - pycparser - secretstorage - six - ] ++ lib.optional useLedger ledger - ++ lib.optional useHledger hledger; + ]; - # Checks require ledger as a python package, - # ledger does not support python3 while ledger-autosync requires it. - nativeCheckInputs = with python3Packages; [ ledger hledger nose mock pytestCheckHook ]; + nativeCheckInputs = [ + hledger + ledger + python3Packages.ledger + python3Packages.pytestCheckHook + ]; # Disable some non-passing tests: # https://github.com/egh/ledger-autosync/issues/127 From 9ec4473be5514bce8ba53a77995c899fcda77f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 12 Aug 2024 11:30:27 -0700 Subject: [PATCH 3/4] ledger-autosync: modernize --- .../office/ledger-autosync/default.nix | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/office/ledger-autosync/default.nix b/pkgs/applications/office/ledger-autosync/default.nix index aa1947036186b..d5aed4793dafb 100644 --- a/pkgs/applications/office/ledger-autosync/default.nix +++ b/pkgs/applications/office/ledger-autosync/default.nix @@ -1,22 +1,23 @@ -{ lib -, python3Packages -, fetchFromGitHub -, fetchpatch2 -, ledger -, hledger +{ + lib, + python3Packages, + fetchFromGitHub, + fetchpatch2, + ledger, + hledger, }: python3Packages.buildPythonApplication rec { pname = "ledger-autosync"; version = "1.0.3"; - format = "pyproject"; + pyproject = true; # no tests included in PyPI tarball src = fetchFromGitHub { owner = "egh"; repo = "ledger-autosync"; rev = "v${version}"; - sha256 = "0n3y4qxsv1cyvyap95h3rj4bj1sinyfgsajygm7s8di3j5aabqr2"; + hash = "sha256-IuOlVJEjNqRPfV4q/Zy3UQe5iMwDlnSV356FrTsmflg="; }; patches = [ @@ -32,11 +33,9 @@ python3Packages.buildPythonApplication rec { }) ]; - nativeBuildInputs = with python3Packages; [ - poetry-core - ]; + build-system = with python3Packages; [ poetry-core ]; - propagatedBuildInputs = with python3Packages; [ + dependencies = with python3Packages; [ ofxclient ofxparse ]; @@ -57,8 +56,9 @@ python3Packages.buildPythonApplication rec { meta = with lib; { homepage = "https://github.com/egh/ledger-autosync"; + changelog = "https://github.com/egh/ledger-autosync/releases/tag/v${version}"; description = "OFX/CSV autosync for ledger and hledger"; - license = licenses.gpl3; + license = licenses.gpl3Plus; maintainers = with maintainers; [ eamsden ]; }; } From 9faf61f9fbecc5d59969b50fe1ca63765691baeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 12 Aug 2024 11:32:50 -0700 Subject: [PATCH 4/4] ledger-autosync: move to pkgs/by-name --- .../default.nix => by-name/le/ledger-autosync/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{applications/office/ledger-autosync/default.nix => by-name/le/ledger-autosync/package.nix} (100%) diff --git a/pkgs/applications/office/ledger-autosync/default.nix b/pkgs/by-name/le/ledger-autosync/package.nix similarity index 100% rename from pkgs/applications/office/ledger-autosync/default.nix rename to pkgs/by-name/le/ledger-autosync/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2a8e717d40474..b3f38d955dbf4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31696,8 +31696,6 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) Foundation; }; - ledger-autosync = callPackage ../applications/office/ledger-autosync { }; - ledger-web = callPackage ../applications/office/ledger-web { }; ledger2beancount = callPackage ../tools/text/ledger2beancount { };