Files
nixpkgs/pkgs/development/python-modules/filedate/default.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e458
2025-04-08 02:57:25 -04:00

60 lines
1.6 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
python-dateutil,
setuptools,
}:
buildPythonPackage rec {
pname = "filedate";
version = "3.0";
pyproject = true;
src = fetchFromGitHub {
owner = "kubinka0505";
repo = "filedate";
rev = version;
hash = "sha256-HvuGP+QlUlfAUfFmaVVvtPHGdrbWVxghQipnqTTvAQc=";
};
sourceRoot = "${src.name}/Files";
# The repo stores everything in "src" and uses setup.py to move "src" ->
# "filedate" before calling setup() and then tries to rename "filedate" back
# to "src" after.
postPatch = ''
mv src filedate
substituteInPlace setup.py \
--replace-fail "__title__ = os.path.basename(os.path.dirname(os.path.dirname(__file__)))" '__title__ = "filedate"'
substituteInPlace setup.py \
--replace-fail "cleanup = True" "cleanup = False"
# Disable renaming "filedate" dir back to "src"
substituteInPlace setup.py \
--replace-fail "if os.path.exists(__title__):" ""
substituteInPlace setup.py \
--replace-fail " os.rename(__title__, directory)" ""
'';
build-system = [ setuptools ];
dependencies = [ python-dateutil ];
pythonImportsCheck = [ "filedate" ];
nativeCheckInputs = [ pytestCheckHook ];
pytestFlagsArray = [ "tests/unit.py" ];
disabledTests = [ "test_created" ];
meta = {
description = "Simple, convenient and cross-platform file date changing library";
homepage = "https://github.com/kubinka0505/filedate";
changelog = "https://github.com/kubinka0505/filedate/blob/${src.rev}/Documents/ChangeLog.md";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ thornycrackers ];
};
}