nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 coreutils,
6 setuptools,
7 pbr,
8 prettytable,
9 keystoneauth1,
10 requests,
11 warlock,
12 openstacksdk,
13 oslo-i18n,
14 oslo-utils,
15 wrapt,
16 pyopenssl,
17 stestr,
18 testscenarios,
19 ddt,
20 requests-mock,
21 writeText,
22}:
23let
24 pname = "python-glanceclient";
25 version = "4.11.0";
26
27 disabledTests = [
28 # Skip tests which require networking.
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 # asserts exact amount of mock calls
44 "test_cache_schemas_gets_when_forced"
45 "test_cache_schemas_gets_when_not_exists"
46 ];
47in
48buildPythonPackage {
49 inherit pname version;
50 pyproject = true;
51
52 src = fetchPypi {
53 pname = "python_glanceclient";
54 inherit version;
55 hash = "sha256-XOIRi/50YpNIBZFmF+U3vFsA/UyrP7e7iKT5JTlwVi0=";
56 };
57
58 postPatch = ''
59 substituteInPlace glanceclient/tests/unit/v1/test_shell.py \
60 --replace-fail "/bin/echo" "${lib.getExe' coreutils "echo"}"
61 '';
62
63 nativeBuildInputs = [ setuptools ];
64
65 propagatedBuildInputs = [
66 pbr
67 prettytable
68 keystoneauth1
69 requests
70 warlock
71 oslo-utils
72 oslo-i18n
73 wrapt
74 pyopenssl
75 ];
76
77 nativeCheckInputs = [
78 ddt
79 openstacksdk
80 requests-mock
81 stestr
82 testscenarios
83 ];
84
85 checkPhase = ''
86 runHook preCheck
87 stestr run -e ${writeText "disabled-tests" (lib.concatStringsSep "\n" disabledTests)}
88 runHook postCheck
89 '';
90
91 pythonImportsCheck = [ "glanceclient" ];
92
93 meta = {
94 description = "Python bindings for the OpenStack Images API";
95 homepage = "https://github.com/openstack/python-glanceclient/";
96 license = lib.licenses.asl20;
97 teams = [ lib.teams.openstack ];
98 };
99}