From f9374fce3ccb2dd1f806327fd7f6a5431fec25ae Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 7 Jun 2026 19:25:54 +0000 Subject: [PATCH] python3Packages.courlan: 1.3.2 -> 1.4.0 Changelog: https://github.com/adbar/courlan/blob/v1.4.0/HISTORY.md --- .../python-modules/courlan/default.nix | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/courlan/default.nix b/pkgs/development/python-modules/courlan/default.nix index c87f84a308c8..d3e63da7213b 100644 --- a/pkgs/development/python-modules/courlan/default.nix +++ b/pkgs/development/python-modules/courlan/default.nix @@ -1,32 +1,49 @@ { lib, - babel, buildPythonPackage, - fetchPypi, - langcodes, - pytestCheckHook, + fetchFromGitHub, + + # build-system, setuptools, + + # dependencies + babel, + langcodes, tld, urllib3, + + # tests + pytest-httpserver, + pytestCheckHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "courlan"; - version = "1.3.2"; + version = "1.4.0"; pyproject = true; + __structuredAttrs = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-C2b02zqcOabiLdJHxyz6pX1o6mYOlLsshOx9uHEq8ZA="; + src = fetchFromGitHub { + owner = "adbar"; + repo = "courlan"; + tag = "v${finalAttrs.version}"; + hash = "sha256-hDbeAd/gil6S8zggBjmrDmnW3DMMdRvG1vULuhYA1zc="; }; # Tests try to write to /tmp directly. use $TMPDIR instead. - postPatch = '' - substituteInPlace tests/unit_tests.py \ - --replace-fail "\"courlan --help\"" "\"$out/bin/courlan --help\"" \ - --replace-fail "courlan_bin = \"courlan\"" "courlan_bin = \"$out/bin/courlan\"" \ - --replace-fail "/tmp" "$TMPDIR" - ''; + postPatch = + let + courlanBinPath = "${placeholder "out"}/bin/courlan"; + in + '' + substituteInPlace tests/unit_tests.py \ + --replace-fail \ + 'assert os.system("courlan --help") == 0' \ + 'assert os.system("${courlanBinPath} --help") == 0' \ + --replace-fail \ + 'courlan_bin = "courlan"' \ + 'courlan_bin = "${courlanBinPath}"' + ''; build-system = [ setuptools ]; @@ -37,19 +54,24 @@ buildPythonPackage rec { urllib3 ]; - nativeCheckInputs = [ pytestCheckHook ]; + nativeCheckInputs = [ + pytest-httpserver + pytestCheckHook + ]; # disable tests that require an internet connection disabledTests = [ "test_urlcheck" ]; pythonImportsCheck = [ "courlan" ]; + __darwinAllowLocalNetworking = true; + meta = { description = "Clean, filter and sample URLs to optimize data collection"; homepage = "https://github.com/adbar/courlan"; - changelog = "https://github.com/adbar/courlan/blob/v${version}/HISTORY.md"; + changelog = "https://github.com/adbar/courlan/blob/${finalAttrs.src.tag}/HISTORY.md"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ jokatzke ]; mainProgram = "courlan"; }; -} +})