From 6d45281dde8fc05e6ab0e706681bfbb6330ed2ed Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Sat, 22 Jul 2023 20:14:00 -0700 Subject: [PATCH] csvs-to-sqlite: 1.2 -> 1.3 1. Remove pin on click 7, because except for one unit test that checks the help output too strictly, the app still works with click 8. 2. Pull in patches that make the app compatible with pandas 2. --- pkgs/tools/misc/csvs-to-sqlite/default.nix | 56 ++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/pkgs/tools/misc/csvs-to-sqlite/default.nix b/pkgs/tools/misc/csvs-to-sqlite/default.nix index 60168b2e44f..dc140c1c0c0 100644 --- a/pkgs/tools/misc/csvs-to-sqlite/default.nix +++ b/pkgs/tools/misc/csvs-to-sqlite/default.nix @@ -1,36 +1,35 @@ -{ lib, python3, fetchFromGitHub }: +{ lib, python3, fetchFromGitHub, fetchpatch }: -let - # csvs-to-sqlite is currently not compatible with Click 8. See the following - # https://github.com/simonw/csvs-to-sqlite/issues/80 - # - # Workaround the issue by providing click 7 explicitly. - python = python3.override { - packageOverrides = self: super: { - # Use click 7 - click = super.click.overridePythonAttrs (old: rec { - version = "7.1.2"; - src = old.src.override { - inherit version; - hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo="; - }; - }); - }; - }; -in with python.pkgs; buildPythonApplication rec { +with python3.pkgs; buildPythonApplication rec { pname = "csvs-to-sqlite"; - version = "1.2"; + version = "1.3"; format = "setuptools"; - disabled = !isPy3k; - src = fetchFromGitHub { owner = "simonw"; repo = pname; rev = version; - hash = "sha256-ZG7Yto8q9QNNJPB/LMwzucLfCGiqwBd3l0ePZs5jKV0"; + hash = "sha256-wV6htULG3lg2IhG2bXmc/9vjcK8/+WA7jm3iJu4ZoOE="; }; + patches = [ + # https://github.com/simonw/csvs-to-sqlite/pull/92 + (fetchpatch { + name = "pandas2-compatibility-1.patch"; + url = "https://github.com/simonw/csvs-to-sqlite/commit/fcd5b9c7485bc7b95bf2ed9507f18a60728e0bcb.patch"; + hash = "sha256-ZmaNWxsqeNw5H5gAih66DLMmzmePD4no1B5mTf8aFvI="; + }) + (fetchpatch { + name = "pandas2-compatibility-2.patch"; + url = "https://github.com/simonw/csvs-to-sqlite/commit/3d190aa44e8d3a66a9a3ca5dc11c6fe46da024df.patch"; + hash = "sha256-uYUH0Mhn6LIf+AHcn6WuCo5zFuSNWOZBM+AoqkmMnSI="; + }) + ]; + + nativeBuildInputs = [ + pythonRelaxDepsHook + ]; + propagatedBuildInputs = [ click dateparser @@ -39,15 +38,24 @@ in with python.pkgs; buildPythonApplication rec { six ]; + pythonRelaxDeps = [ + "click" + ]; + nativeCheckInputs = [ + cogapp pytestCheckHook ]; + disabledTests = [ + # Test needs to be adjusted for click >= 8. + "test_if_cog_needs_to_be_run" + ]; + meta = with lib; { description = "Convert CSV files into a SQLite database"; homepage = "https://github.com/simonw/csvs-to-sqlite"; license = licenses.asl20; maintainers = [ maintainers.costrouc ]; }; - }