python311Packages.pendulum: 2.1.2 -> 3.0.0

retires the temporary pendulum_3 attribute.
This commit is contained in:
Martin Weinelt 2024-03-08 15:11:08 +01:00
parent 03c2e437c0
commit c53ad8124b
4 changed files with 83 additions and 124 deletions

View File

@ -42,7 +42,7 @@ python3.pkgs.buildPythonApplication rec {
loguru
more-itertools
packaging
pendulum_3
pendulum
psutil
pynzb
pyrsistent

View File

@ -1,99 +0,0 @@
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, isPyPy
# build-system
, poetry-core
, rustPlatform
# native dependencies
, iconv
# dependencies
, backports-zoneinfo
, importlib-resources
, python-dateutil
, time-machine
, tzdata
# tests
, pytestCheckHook
, pytz
}:
buildPythonPackage rec {
pname = "pendulum";
version = "3.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "sdispater";
repo = "pendulum";
rev = "refs/tags/${version}";
hash = "sha256-v0kp8dklvDeC7zdTDOpIbpuj13aGub+oCaYz2ytkEpI=";
};
postPatch = ''
substituteInPlace rust/Cargo.lock \
--replace "3.0.0-beta-1" "3.0.0"
'';
cargoRoot = "rust";
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${src.name}/rust";
name = "${pname}-${version}";
hash = "sha256-6fw0KgnPIMfdseWcunsGjvjVB+lJNoG3pLDqkORPJ0I=";
postPatch = ''
substituteInPlace Cargo.lock \
--replace "3.0.0-beta-1" "3.0.0"
'';
};
nativeBuildInputs = [
poetry-core
rustPlatform.maturinBuildHook
rustPlatform.cargoSetupHook
];
buildInputs = lib.optionals stdenv.isDarwin [
iconv
];
propagatedBuildInputs = [
python-dateutil
tzdata
] ++ lib.optional (!isPyPy) [
time-machine
] ++ lib.optionals (pythonOlder "3.9") [
backports-zoneinfo
importlib-resources
];
pythonImportsCheck = [
"pendulum"
];
nativeCheckInputs = [
pytestCheckHook
pytz
];
disabledTestPaths = [
"tests/benchmarks"
] ++ lib.optionals stdenv.isDarwin [
# PermissionError: [Errno 1] Operation not permitted: '/etc/localtime'
"tests/testing/test_time_travel.py"
];
meta = with lib; {
description = "Python datetimes made easy";
homepage = "https://github.com/sdispater/pendulum";
changelog = "https://github.com/sdispater/pendulum/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}

View File

@ -1,36 +1,99 @@
{ lib, fetchPypi, buildPythonPackage, pythonOlder
, python-dateutil
, importlib-metadata
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, isPyPy
# build-system
, poetry-core
, pytzdata
, typing
, rustPlatform
# native dependencies
, iconv
# dependencies
, backports-zoneinfo
, importlib-resources
, python-dateutil
, time-machine
, tzdata
# tests
, pytestCheckHook
, pytz
}:
buildPythonPackage rec {
pname = "pendulum";
version = "2.1.2";
format = "pyproject";
version = "3.0.0";
pyproject = true;
src = fetchPypi {
inherit pname version;
sha256 = "b06a0ca1bfe41c990bbf0c029f0b6501a7f2ec4e38bfec730712015e8860f207";
src = fetchFromGitHub {
owner = "sdispater";
repo = "pendulum";
rev = "refs/tags/${version}";
hash = "sha256-v0kp8dklvDeC7zdTDOpIbpuj13aGub+oCaYz2ytkEpI=";
};
preBuild = ''
export HOME=$TMPDIR
postPatch = ''
substituteInPlace rust/Cargo.lock \
--replace "3.0.0-beta-1" "3.0.0"
'';
build-system = [ poetry-core ];
dependencies = [ python-dateutil pytzdata ]
++ lib.optional (pythonOlder "3.5") typing
++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
cargoRoot = "rust";
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "source/rust";
name = "${pname}-${version}";
hash = "sha256-6fw0KgnPIMfdseWcunsGjvjVB+lJNoG3pLDqkORPJ0I=";
postPatch = ''
substituteInPlace Cargo.lock \
--replace "3.0.0-beta-1" "3.0.0"
'';
};
# No tests
doCheck = false;
nativeBuildInputs = [
poetry-core
rustPlatform.maturinBuildHook
rustPlatform.cargoSetupHook
];
buildInputs = lib.optionals stdenv.isDarwin [
iconv
];
propagatedBuildInputs = [
python-dateutil
tzdata
] ++ lib.optional (!isPyPy) [
time-machine
] ++ lib.optionals (pythonOlder "3.9") [
backports-zoneinfo
importlib-resources
];
pythonImportsCheck = [
"pendulum"
];
nativeCheckInputs = [
pytestCheckHook
pytz
];
disabledTestPaths = [
"tests/benchmarks"
] ++ lib.optionals stdenv.isDarwin [
# PermissionError: [Errno 1] Operation not permitted: '/etc/localtime'
"tests/testing/test_time_travel.py"
];
meta = with lib; {
description = "Python datetimes made easy";
homepage = "https://github.com/sdispater/pendulum";
changelog = "https://github.com/sdispater/pendulum/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}

View File

@ -9358,12 +9358,7 @@ self: super: with self; {
pem = callPackage ../development/python-modules/pem { };
pendulum = if pythonAtLeast "3.12" then
pendulum_3
else
callPackage ../development/python-modules/pendulum { };
pendulum_3 = callPackage ../development/python-modules/pendulum/3.nix { };
pendulum = callPackage ../development/python-modules/pendulum { };
pep440 = callPackage ../development/python-modules/pep440 { };