writers: add writeGuile[Bin] (#364531)
[NixPkgs.git] / pkgs / development / python-modules / pendulum / default.nix
blobcd49841eecad59b7adafeee60291798af9dd5199
2   lib,
3   stdenv,
4   buildPythonPackage,
5   fetchFromGitHub,
6   pythonOlder,
7   isPyPy,
9   # build-system
10   poetry-core,
11   rustPlatform,
13   # native dependencies
14   iconv,
16   # dependencies
17   importlib-resources,
18   python-dateutil,
19   time-machine,
20   tzdata,
22   # tests
23   pytestCheckHook,
24   pytz,
27 buildPythonPackage rec {
28   pname = "pendulum";
29   version = "3.0.0";
30   pyproject = true;
32   src = fetchFromGitHub {
33     owner = "sdispater";
34     repo = "pendulum";
35     rev = "refs/tags/${version}";
36     hash = "sha256-v0kp8dklvDeC7zdTDOpIbpuj13aGub+oCaYz2ytkEpI=";
37   };
39   postPatch = ''
40     substituteInPlace rust/Cargo.lock \
41       --replace "3.0.0-beta-1" "3.0.0"
42   '';
44   cargoRoot = "rust";
45   cargoDeps = rustPlatform.fetchCargoTarball {
46     inherit src;
47     sourceRoot = "${src.name}/rust";
48     name = "${pname}-${version}";
49     hash = "sha256-6fw0KgnPIMfdseWcunsGjvjVB+lJNoG3pLDqkORPJ0I=";
50     postPatch = ''
51       substituteInPlace Cargo.lock \
52         --replace "3.0.0-beta-1" "3.0.0"
53     '';
54   };
56   nativeBuildInputs = [
57     poetry-core
58     rustPlatform.maturinBuildHook
59     rustPlatform.cargoSetupHook
60   ];
62   buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ iconv ];
64   propagatedBuildInputs =
65     [
66       python-dateutil
67       tzdata
68     ]
69     ++ lib.optional (!isPyPy) [ time-machine ]
70     ++ lib.optionals (pythonOlder "3.9") [
71       importlib-resources
72     ];
74   pythonImportsCheck = [ "pendulum" ];
76   nativeCheckInputs = [
77     pytestCheckHook
78     pytz
79   ];
81   disabledTestPaths =
82     [ "tests/benchmarks" ]
83     ++ lib.optionals stdenv.hostPlatform.isDarwin [
84       # PermissionError: [Errno 1] Operation not permitted: '/etc/localtime'
85       "tests/testing/test_time_travel.py"
86     ];
88   meta = with lib; {
89     description = "Python datetimes made easy";
90     homepage = "https://github.com/sdispater/pendulum";
91     changelog = "https://github.com/sdispater/pendulum/blob/${src.rev}/CHANGELOG.md";
92     license = licenses.mit;
93     maintainers = [ ];
94   };