1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 python-dateutil,
7 setuptools,
8}:
9buildPythonPackage rec {
10 pname = "filedate";
11 version = "3.0";
12 pyproject = true;
13
14 src = fetchFromGitHub {
15 owner = "kubinka0505";
16 repo = "filedate";
17 rev = version;
18 hash = "sha256-HvuGP+QlUlfAUfFmaVVvtPHGdrbWVxghQipnqTTvAQc=";
19 };
20
21 sourceRoot = "${src.name}/Files";
22
23 # The repo stores everything in "src" and uses setup.py to move "src" ->
24 # "filedate" before calling setup() and then tries to rename "filedate" back
25 # to "src" after.
26 postPatch = ''
27 mv src filedate
28 substituteInPlace setup.py \
29 --replace-fail "__title__ = os.path.basename(os.path.dirname(os.path.dirname(__file__)))" '__title__ = "filedate"'
30 substituteInPlace setup.py \
31 --replace-fail "cleanup = True" "cleanup = False"
32
33 # Disable renaming "filedate" dir back to "src"
34 substituteInPlace setup.py \
35 --replace-fail "if os.path.exists(__title__):" ""
36 substituteInPlace setup.py \
37 --replace-fail " os.rename(__title__, directory)" ""
38 '';
39
40 build-system = [ setuptools ];
41
42 dependencies = [ python-dateutil ];
43
44 pythonImportsCheck = [ "filedate" ];
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 enabledTestPaths = [ "tests/unit.py" ];
49
50 disabledTests = [ "test_created" ];
51
52 meta = {
53 description = "Simple, convenient and cross-platform file date changing library";
54 homepage = "https://github.com/kubinka0505/filedate";
55 changelog = "https://github.com/kubinka0505/filedate/blob/${src.rev}/Documents/ChangeLog.md";
56 license = lib.licenses.gpl3Only;
57 maintainers = with lib.maintainers; [ thornycrackers ];
58 };
59}