1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 coreutils,
6 setuptools,
7 pbr,
8 prettytable,
9 keystoneauth1,
10 requests,
11 warlock,
12 oslo-utils,
13 oslo-i18n,
14 wrapt,
15 pyopenssl,
16 pythonOlder,
17 stestr,
18 testscenarios,
19 ddt,
20 requests-mock,
21 writeText,
22}:
23let
24 pname = "python-glanceclient";
25 version = "4.7.0";
26
27 # Skip tests which require networking.
28 disabledTests = [
29 "test_http_chunked_response"
30 "test_v1_download_has_no_stray_output_to_stdout"
31 "test_v2_requests_valid_cert_verification"
32 "test_download_has_no_stray_output_to_stdout"
33 "test_v1_requests_cert_verification_no_compression"
34 "test_v1_requests_cert_verification"
35 "test_v2_download_has_no_stray_output_to_stdout"
36 "test_v2_requests_bad_ca"
37 "test_v2_requests_bad_cert"
38 "test_v2_requests_cert_verification_no_compression"
39 "test_v2_requests_cert_verification"
40 "test_v2_requests_valid_cert_no_key"
41 "test_v2_requests_valid_cert_verification_no_compression"
42 "test_log_request_id_once"
43 ];
44in
45buildPythonPackage {
46 inherit pname version;
47 pyproject = true;
48
49 disabled = pythonOlder "3.8";
50
51 src = fetchPypi {
52 inherit pname version;
53 hash = "sha256-wZRS7xLaPEhLadIqiIznp0kQvbh4O76RJIxg76U3iBA=";
54 };
55
56 postPatch = ''
57 substituteInPlace glanceclient/tests/unit/v1/test_shell.py \
58 --replace-fail "/bin/echo" "${lib.getExe' coreutils "echo"}"
59 '';
60
61 nativeBuildInputs = [ setuptools ];
62
63 propagatedBuildInputs = [
64 pbr
65 prettytable
66 keystoneauth1
67 requests
68 warlock
69 oslo-utils
70 oslo-i18n
71 wrapt
72 pyopenssl
73 ];
74
75 nativeCheckInputs = [
76 stestr
77 testscenarios
78 ddt
79 requests-mock
80 ];
81
82 checkPhase = ''
83 runHook preCheck
84 stestr run -e ${writeText "disabled-tests" (lib.concatStringsSep "\n" disabledTests)}
85 runHook postCheck
86 '';
87
88 pythonImportsCheck = [ "glanceclient" ];
89
90 meta = with lib; {
91 description = "Python bindings for the OpenStack Images API";
92 homepage = "https://github.com/openstack/python-glanceclient/";
93 license = licenses.asl20;
94 maintainers = teams.openstack.members;
95 };
96}