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.33.0";
29 format = "setuptools";
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-4TlJcquK8MC9zQfLKmb88B5xHje1kbPD2jSLiR+N8hs=";
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 = [
42 installShellFiles
43 pbr
44 ];
45
46 propagatedBuildInputs = [
47 cryptography
48 eventlet
49 greenlet
50 lxml
51 netifaces
52 pastedeploy
53 pyeclib
54 requests
55 setuptools
56 six
57 xattr
58 ];
59
60 postInstall = ''
61 installManPage doc/manpages/*
62 '';
63
64 nativeCheckInputs = [
65 boto3
66 mock
67 stestr
68 swiftclient
69 ];
70
71 # a lot of tests currently fail while establishing a connection
72 doCheck = false;
73
74 checkPhase = ''
75 echo "nameserver 127.0.0.1" > resolv.conf
76 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
77 export LD_PRELOAD=${libredirect}/lib/libredirect.so
78
79 export SWIFT_TEST_CONFIG_FILE=test/sample.conf
80
81 stestr run
82 '';
83
84 pythonImportsCheck = [ "swift" ];
85
86 meta = with lib; {
87 description = "OpenStack Object Storage";
88 homepage = "https://github.com/openstack/swift";
89 license = licenses.asl20;
90 maintainers = teams.openstack.members;
91 };
92}