1{ lib
2, stdenv
3, attrs
4, beautifulsoup4
5, buildPythonPackage
6, click
7, fetchPypi
8, intbitset
9, pytest-xdist
10, pytestCheckHook
11, pythonAtLeast
12, pythonOlder
13, requests
14, saneyaml
15, setuptools-scm
16, text-unidecode
17, typing
18}:
19
20buildPythonPackage rec {
21 pname = "commoncode";
22 version = "31.0.0";
23 format = "pyproject";
24
25 disabled = pythonOlder "3.6";
26
27 src = fetchPypi {
28 inherit pname version;
29 sha256 = "sha256-iX7HjsbW9rUgG35XalqfXh2+89vEiwish90FGOpkzRo=";
30 };
31
32 postPatch = ''
33 substituteInPlace setup.cfg \
34 --replace "intbitset >= 2.3.0, < 3.0" "intbitset >= 2.3.0"
35 '';
36
37 dontConfigure = true;
38
39 nativeBuildInputs = [
40 setuptools-scm
41 ];
42
43 propagatedBuildInputs = [
44 attrs
45 beautifulsoup4
46 click
47 intbitset
48 requests
49 saneyaml
50 text-unidecode
51 ] ++ lib.optionals (pythonOlder "3.7") [
52 typing
53 ];
54
55 checkInputs = [
56 pytestCheckHook
57 pytest-xdist
58 ];
59
60 disabledTests = [
61 # chinese character translates different into latin
62 "test_safe_path_posix_style_chinese_char"
63 # OSError: [Errno 84] Invalid or incomplete multibyte or wide character
64 "test_os_walk_can_walk_non_utf8_path_from_unicode_path"
65 "test_resource_iter_can_walk_non_utf8_path_from_unicode_path"
66 "test_walk_can_walk_non_utf8_path_from_unicode_path"
67 "test_resource_iter_can_walk_non_utf8_path_from_unicode_path_with_dirs"
68 ] ++ lib.optionals stdenv.isDarwin [
69 # expected result is tailored towards the quirks of upstream's
70 # CI environment on darwin
71 "test_searchable_paths"
72 ];
73
74 disabledTestPaths = lib.optionals (pythonAtLeast "3.10") [
75 # https://github.com/nexB/commoncode/issues/36
76 "src/commoncode/fetch.py"
77 ];
78
79 pythonImportsCheck = [
80 "commoncode"
81 ];
82
83 meta = with lib; {
84 description = "A set of common utilities, originally split from ScanCode";
85 homepage = "https://github.com/nexB/commoncode";
86 license = licenses.asl20;
87 maintainers = teams.determinatesystems.members;
88 };
89}