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.8.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 pname = "python_glanceclient";
53 inherit version;
54 hash = "sha256-+FtvyB8ns02hyHSEswl2WdsFKavRxnWV0vD+fLFZA2w=";
55 };
56
57 postPatch = ''
58 substituteInPlace glanceclient/tests/unit/v1/test_shell.py \
59 --replace-fail "/bin/echo" "${lib.getExe' coreutils "echo"}"
60 '';
61
62 nativeBuildInputs = [ setuptools ];
63
64 propagatedBuildInputs = [
65 pbr
66 prettytable
67 keystoneauth1
68 requests
69 warlock
70 oslo-utils
71 oslo-i18n
72 wrapt
73 pyopenssl
74 ];
75
76 nativeCheckInputs = [
77 stestr
78 testscenarios
79 ddt
80 requests-mock
81 ];
82
83 checkPhase = ''
84 runHook preCheck
85 stestr run -e ${writeText "disabled-tests" (lib.concatStringsSep "\n" disabledTests)}
86 runHook postCheck
87 '';
88
89 pythonImportsCheck = [ "glanceclient" ];
90
91 meta = with lib; {
92 description = "Python bindings for the OpenStack Images API";
93 homepage = "https://github.com/openstack/python-glanceclient/";
94 license = licenses.asl20;
95 teams = [ teams.openstack ];
96 };
97}