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