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 "user_data_repr"
66 # https://github.com/PyFilesystem/pyfilesystem2/issues/568
67 "test_remove"
68 # Tests require network access
69 "TestFTPFS"
70 ]
71 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
72 # remove if https://github.com/PyFilesystem/pyfilesystem2/issues/430#issue-707878112 resolved
73 "test_ftpfs"
74 ];
75
76 pythonImportsCheck = [ "fs" ];
77
78 __darwinAllowLocalNetworking = true;
79
80 meta = with lib; {
81 description = "Filesystem abstraction";
82 homepage = "https://github.com/PyFilesystem/pyfilesystem2";
83 changelog = "https://github.com/PyFilesystem/pyfilesystem2/blob/v${version}/CHANGELOG.md";
84 license = licenses.bsd3;
85 maintainers = with maintainers; [ lovek323 ];
86 platforms = platforms.unix;
87 };
88}