1{
2 lib,
3 stdenv,
4 appdirs,
5 buildPythonPackage,
6 fetchPypi,
7 mock,
8 psutil,
9 pyftpdlib,
10 pytestCheckHook,
11 pythonOlder,
12 pytz,
13 setuptools,
14 six,
15}:
16
17buildPythonPackage rec {
18 pname = "fs";
19 version = "2.4.16";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-rpfH1RIT9LcLapWCklMCiQkN46fhWEHhCPvhRPBp0xM=";
27 };
28
29 postPatch = ''
30 # https://github.com/PyFilesystem/pyfilesystem2/pull/591
31 substituteInPlace tests/test_ftpfs.py \
32 --replace ThreadedTestFTPd FtpdThreadWrapper
33 '';
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 setuptools
39 six
40 appdirs
41 pytz
42 ];
43
44 nativeCheckInputs = [
45 pyftpdlib
46 mock
47 psutil
48 pytestCheckHook
49 ];
50
51 LC_ALL = "en_US.utf-8";
52
53 preCheck = ''
54 HOME=$(mktemp -d)
55 '';
56
57 disabledTestPaths = [
58 # Circular dependency with parameterized
59 "tests/test_move.py"
60 "tests/test_mirror.py"
61 "tests/test_copy.py"
62 ];
63
64 disabledTests =
65 [
66 "user_data_repr"
67 # https://github.com/PyFilesystem/pyfilesystem2/issues/568
68 "test_remove"
69 # Tests require network access
70 "TestFTPFS"
71 ]
72 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
73 # remove if https://github.com/PyFilesystem/pyfilesystem2/issues/430#issue-707878112 resolved
74 "test_ftpfs"
75 ];
76
77 pythonImportsCheck = [ "fs" ];
78
79 __darwinAllowLocalNetworking = true;
80
81 meta = with lib; {
82 description = "Filesystem abstraction";
83 homepage = "https://github.com/PyFilesystem/pyfilesystem2";
84 changelog = "https://github.com/PyFilesystem/pyfilesystem2/blob/v${version}/CHANGELOG.md";
85 license = licenses.bsd3;
86 maintainers = with maintainers; [ lovek323 ];
87 platforms = platforms.unix;
88 };
89}