Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 104 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 pythonOlder, 8 isPyPy, 9 10 # build-system 11 poetry-core, 12 rustPlatform, 13 14 # native dependencies 15 iconv, 16 17 # dependencies 18 importlib-resources, 19 python-dateutil, 20 time-machine, 21 tzdata, 22 23 # tests 24 pytestCheckHook, 25 pytz, 26}: 27 28buildPythonPackage rec { 29 pname = "pendulum"; 30 version = "3.0.0"; 31 pyproject = true; 32 33 src = fetchFromGitHub { 34 owner = "sdispater"; 35 repo = "pendulum"; 36 tag = version; 37 hash = "sha256-v0kp8dklvDeC7zdTDOpIbpuj13aGub+oCaYz2ytkEpI="; 38 }; 39 40 postPatch = '' 41 substituteInPlace rust/Cargo.lock \ 42 --replace "3.0.0-beta-1" "3.0.0" 43 ''; 44 45 cargoRoot = "rust"; 46 cargoDeps = rustPlatform.fetchCargoVendor { 47 inherit pname version src; 48 sourceRoot = "${src.name}/rust"; 49 hash = "sha256-6WgGIfz9I+xRJqXWhjfGDZM1umYwVlUEpLAiecZNZmI="; 50 postPatch = '' 51 substituteInPlace Cargo.lock \ 52 --replace "3.0.0-beta-1" "3.0.0" 53 ''; 54 }; 55 56 patches = [ 57 # fix build on 32bit 58 # https://github.com/sdispater/pendulum/pull/842 59 (fetchpatch { 60 url = "https://github.com/sdispater/pendulum/commit/6f2fcb8b025146ae768a5889be4a437fbd3156d6.patch"; 61 hash = "sha256-47591JvpADxGQT2q7EYWHfStaiWyP7dt8DPTq0tiRvk="; 62 }) 63 ]; 64 65 nativeBuildInputs = [ 66 poetry-core 67 rustPlatform.maturinBuildHook 68 rustPlatform.cargoSetupHook 69 ]; 70 71 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ iconv ]; 72 73 propagatedBuildInputs = 74 [ 75 python-dateutil 76 tzdata 77 ] 78 ++ lib.optional (!isPyPy) [ time-machine ] 79 ++ lib.optionals (pythonOlder "3.9") [ 80 importlib-resources 81 ]; 82 83 pythonImportsCheck = [ "pendulum" ]; 84 85 nativeCheckInputs = [ 86 pytestCheckHook 87 pytz 88 ]; 89 90 disabledTestPaths = 91 [ "tests/benchmarks" ] 92 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 93 # PermissionError: [Errno 1] Operation not permitted: '/etc/localtime' 94 "tests/testing/test_time_travel.py" 95 ]; 96 97 meta = with lib; { 98 description = "Python datetimes made easy"; 99 homepage = "https://github.com/sdispater/pendulum"; 100 changelog = "https://github.com/sdispater/pendulum/blob/${src.rev}/CHANGELOG.md"; 101 license = licenses.mit; 102 maintainers = [ ]; 103 }; 104}