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 , fetchPypi
, langcodes , langcodes
, pytestCheckHook , pytestCheckHook
, pythonOlder
, setuptools
, tld , tld
, urllib3 , urllib3
, pythonOlder
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "courlan"; pname = "courlan";
version = "1.1.0"; version = "1.1.0";
format = "setuptools"; pyproject = true;
disabled = pythonOlder "3.6"; disabled = pythonOlder "3.6";
@ -21,7 +22,19 @@ buildPythonPackage rec {
hash = "sha256-1wZoQzTxi+StofvVfyaArfADZkj22ECFL3pIItOt/Y0="; 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 babel
langcodes langcodes
tld tld
@ -37,22 +50,14 @@ buildPythonPackage rec {
"test_urlcheck" "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" ]; pythonImportsCheck = [ "courlan" ];
meta = with lib; { meta = with lib; {
description = "Clean, filter and sample URLs to optimize data collection"; description = "Clean, filter and sample URLs to optimize data collection";
mainProgram = "courlan";
homepage = "https://github.com/adbar/courlan"; homepage = "https://github.com/adbar/courlan";
changelog = "https://github.com/adbar/courlan/blob/v${version}/HISTORY.md"; changelog = "https://github.com/adbar/courlan/blob/v${version}/HISTORY.md";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ jokatzke ]; maintainers = with maintainers; [ jokatzke ];
mainProgram = "courlan";
}; };
} }