python312Packages.courlan: refactor

This commit is contained in:
Fabian Affolter 2024-05-11 22:25:48 +02:00
parent 3e6c1b075c
commit 577710d5ef

View File

@ -4,15 +4,16 @@
, fetchPypi
, langcodes
, pytestCheckHook
, pythonOlder
, setuptools
, tld
, urllib3
, pythonOlder
}:
buildPythonPackage rec {
pname = "courlan";
version = "1.1.0";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.6";
@ -21,7 +22,19 @@ buildPythonPackage rec {
hash = "sha256-1wZoQzTxi+StofvVfyaArfADZkj22ECFL3pIItOt/Y0=";
};
propagatedBuildInputs = [
# 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"
'';
build-system = [
setuptools
];
dependencies = [
babel
langcodes
tld
@ -37,22 +50,14 @@ buildPythonPackage rec {
"test_urlcheck"
];
# tests try to write to /tmp directly. use $TMPDIR instead.
postPatch = ''
substituteInPlace tests/unit_tests.py \
--replace "\"courlan --help\"" "\"$out/bin/courlan --help\"" \
--replace "courlan_bin = \"courlan\"" "courlan_bin = \"$out/bin/courlan\"" \
--replace "/tmp" "$TMPDIR"
'';
pythonImportsCheck = [ "courlan" ];
meta = with lib; {
description = "Clean, filter and sample URLs to optimize data collection";
mainProgram = "courlan";
homepage = "https://github.com/adbar/courlan";
changelog = "https://github.com/adbar/courlan/blob/v${version}/HISTORY.md";
license = licenses.asl20;
maintainers = with maintainers; [ jokatzke ];
mainProgram = "courlan";
};
}