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