1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 boto3,
6 cryptography,
7 eventlet,
8 greenlet,
9 iana-etc,
10 installShellFiles,
11 libredirect,
12 lxml,
13 mock,
14 netifaces,
15 pastedeploy,
16 pbr,
17 pyeclib,
18 requests,
19 setuptools,
20 six,
21 stestr,
22 swiftclient,
23 xattr,
24}:
25
26buildPythonPackage rec {
27 pname = "swift";
28 version = "2.34.0";
29 pyproject = true;
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-ZvdWWvPUdZIEadxV0nhqgTXhgJJu+hD1LnYCAP+9gpM=";
34 };
35
36 postPatch = ''
37 # files requires boto which is incompatible with python 3.9
38 rm test/functional/s3api/{__init__.py,s3_test_client.py}
39 '';
40
41 nativeBuildInputs = [ installShellFiles ];
42
43 build-system = [
44 pbr
45 setuptools
46 ];
47
48 propagatedBuildInputs = [
49 cryptography
50 eventlet
51 greenlet
52 lxml
53 netifaces
54 pastedeploy
55 pyeclib
56 requests
57 setuptools
58 six
59 xattr
60 ];
61
62 dependencies = [
63 boto3
64 mock
65 stestr
66 swiftclient
67 ];
68
69 postInstall = ''
70 installManPage doc/manpages/*
71 '';
72
73 # a lot of tests currently fail while establishing a connection
74 doCheck = false;
75
76 checkPhase = ''
77 echo "nameserver 127.0.0.1" > resolv.conf
78 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
79 export LD_PRELOAD=${libredirect}/lib/libredirect.so
80
81 export SWIFT_TEST_CONFIG_FILE=test/sample.conf
82
83 stestr run
84 '';
85
86 pythonImportsCheck = [ "swift" ];
87
88 meta = with lib; {
89 description = "OpenStack Object Storage";
90 homepage = "https://github.com/openstack/swift";
91 license = licenses.asl20;
92 maintainers = teams.openstack.members;
93 };
94}