1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, attrs
6, pendulum
7, poetry-core
8, pprintpp
9, pytestCheckHook
10, pythonRelaxDepsHook
11, wrapt
12}:
13
14buildPythonPackage rec {
15 pname = "tbm-utils";
16 version = "2.6.0";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "thebigmunch";
21 repo = pname;
22 rev = "refs/tags/${version}";
23 hash = "sha256-AEKawsAxDSDNkIaXEFFgdEBOY2PpASDrhlDrsnM5eyA=";
24 };
25
26 postPatch = ''
27 substituteInPlace pyproject.toml \
28 --replace 'poetry>=1.0.0' 'poetry-core' \
29 --replace 'poetry.masonry.api' 'poetry.core.masonry.api'
30 '';
31
32 nativeBuildInputs = [
33 poetry-core
34 pythonRelaxDepsHook
35 ];
36
37 propagatedBuildInputs = [
38 attrs
39 pendulum
40 pprintpp
41 wrapt
42 ];
43
44 pythonRelaxDeps = [
45 "attrs"
46 ];
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 ];
51
52 disabledTests = lib.optionals stdenv.isDarwin [
53 # Skip on macOS because /etc/localtime is accessed through the pendulum
54 # library, which is not allowed in a sandboxed build.
55 "test_create_parser_filter_dates"
56 "test_parse_args"
57 ];
58
59 disabledTestPaths = lib.optionals stdenv.isDarwin [
60 # Skip on macOS because /etc/localtime is accessed through the pendulum
61 # library, which is not allowed in a sandboxed build.
62 "tests/test_datetime.py"
63 "tests/test_misc.py"
64 ];
65
66 pythonImportsCheck = [
67 "tbm_utils"
68 ];
69
70 meta = {
71 description = "A commonly-used set of utilities";
72 homepage = "https://github.com/thebigmunch/tbm-utils";
73 changelog = "https://github.com/thebigmunch/tbm-utils/blob/${version}/CHANGELOG.md";
74 license = [ lib.licenses.mit ];
75 };
76}