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 stestr,
17 testscenarios,
18 ddt,
19 requests-mock,
20 writeText,
21}:
22let
23 pname = "python-glanceclient";
24 version = "4.10.0";
25
26 disabledTests = [
27 # Skip tests which require networking.
28 "test_http_chunked_response"
29 "test_v1_download_has_no_stray_output_to_stdout"
30 "test_v2_requests_valid_cert_verification"
31 "test_download_has_no_stray_output_to_stdout"
32 "test_v1_requests_cert_verification_no_compression"
33 "test_v1_requests_cert_verification"
34 "test_v2_download_has_no_stray_output_to_stdout"
35 "test_v2_requests_bad_ca"
36 "test_v2_requests_bad_cert"
37 "test_v2_requests_cert_verification_no_compression"
38 "test_v2_requests_cert_verification"
39 "test_v2_requests_valid_cert_no_key"
40 "test_v2_requests_valid_cert_verification_no_compression"
41 "test_log_request_id_once"
42 # asserts exact amount of mock calls
43 "test_cache_schemas_gets_when_forced"
44 "test_cache_schemas_gets_when_not_exists"
45 ];
46in
47buildPythonPackage {
48 inherit pname version;
49 pyproject = true;
50
51 src = fetchPypi {
52 pname = "python_glanceclient";
53 inherit version;
54 hash = "sha256-/2wtQqF2fFz6PNHSKjcy04qxE9RxrSLE7mShvTlBsQM=";
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}