2024-04-21 15:54:59 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
attrs,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
pendulum,
|
|
|
|
poetry-core,
|
|
|
|
pprintpp,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
wrapt,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "tbm-utils";
|
2020-06-15 15:56:04 +00:00
|
|
|
version = "2.6.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "thebigmunch";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "tbm-utils";
|
2023-08-04 22:07:22 +00:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-AEKawsAxDSDNkIaXEFFgdEBOY2PpASDrhlDrsnM5eyA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
# Migrate to pendulum > 3, https://github.com/thebigmunch/tbm-utils/pull/3
|
|
|
|
(fetchpatch {
|
|
|
|
name = "support-pendulum-3.patch";
|
|
|
|
url = "https://github.com/thebigmunch/tbm-utils/commit/473534fae2d9a8dea9100cead6c54cab3f5cd0cd.patch";
|
|
|
|
hash = "sha256-3T0KhSmO9r1vM67FWEnTZMQV4b5jS2xtPHI0t9NnCmI=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "update-testsupport-pendulum-3.patch";
|
|
|
|
url = "https://github.com/thebigmunch/tbm-utils/commit/a0331d0c15f11cd26bfbb42eebd17296167161ed.patch";
|
|
|
|
hash = "sha256-KG6yfnnBltavbNvIBTdbK+CPXwZTLYl14925RY2a8vs=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
postPatch = ''
|
2023-08-04 22:07:22 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail 'poetry>=1.0.0' 'poetry-core' \
|
|
|
|
--replace-fail 'poetry.masonry.api' 'poetry.core.masonry.api'
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pythonRelaxDeps = [ "attrs" ];
|
|
|
|
|
|
|
|
build-system = [ poetry-core ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pythonRelaxDepsHook ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
|
|
|
pendulum
|
|
|
|
pprintpp
|
|
|
|
wrapt
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
disabledTests = lib.optionals stdenv.isDarwin [
|
|
|
|
# Skip on macOS because /etc/localtime is accessed through the pendulum
|
|
|
|
# library, which is not allowed in a sandboxed build.
|
|
|
|
"test_create_parser_filter_dates"
|
|
|
|
"test_parse_args"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = lib.optionals stdenv.isDarwin [
|
|
|
|
# Skip on macOS because /etc/localtime is accessed through the pendulum
|
|
|
|
# library, which is not allowed in a sandboxed build.
|
|
|
|
"tests/test_datetime.py"
|
|
|
|
"tests/test_misc.py"
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pythonImportsCheck = [ "tbm_utils" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A commonly-used set of utilities";
|
|
|
|
homepage = "https://github.com/thebigmunch/tbm-utils";
|
2023-08-04 22:07:22 +00:00
|
|
|
changelog = "https://github.com/thebigmunch/tbm-utils/blob/${version}/CHANGELOG.md";
|
2024-04-21 15:54:59 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|