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