1{
2 lib,
3 babel,
4 buildPythonPackage,
5 fetchPypi,
6 langcodes,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10 tld,
11 urllib3,
12}:
13
14buildPythonPackage rec {
15 pname = "courlan";
16 version = "1.3.2";
17 pyproject = true;
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-C2b02zqcOabiLdJHxyz6pX1o6mYOlLsshOx9uHEq8ZA=";
24 };
25
26 # Tests try to write to /tmp directly. use $TMPDIR instead.
27 postPatch = ''
28 substituteInPlace tests/unit_tests.py \
29 --replace-fail "\"courlan --help\"" "\"$out/bin/courlan --help\"" \
30 --replace-fail "courlan_bin = \"courlan\"" "courlan_bin = \"$out/bin/courlan\"" \
31 --replace-fail "/tmp" "$TMPDIR"
32 '';
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 babel
38 langcodes
39 tld
40 urllib3
41 ];
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 # disable tests that require an internet connection
46 disabledTests = [ "test_urlcheck" ];
47
48 pythonImportsCheck = [ "courlan" ];
49
50 meta = with lib; {
51 description = "Clean, filter and sample URLs to optimize data collection";
52 homepage = "https://github.com/adbar/courlan";
53 changelog = "https://github.com/adbar/courlan/blob/v${version}/HISTORY.md";
54 license = licenses.asl20;
55 maintainers = with maintainers; [ jokatzke ];
56 mainProgram = "courlan";
57 };
58}