1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, colorlog
7, pyvmomi
8, requests
9, verboselogs
10, pyopenssl
11, setuptools
12, mock
13, pytest-mock
14, pytestCheckHook
15, qemu
16}:
17
18buildPythonPackage rec {
19 pname = "cot";
20 version = "2.2.1";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-9LNVNBX5DarGVvidPoLnmz11F5Mjm7FzpoO0zAzrJjU=";
28 };
29
30 propagatedBuildInputs = [
31 colorlog
32 pyvmomi
33 requests
34 verboselogs
35 pyopenssl
36 setuptools
37 ];
38
39 nativeCheckInputs = [
40 mock
41 pytestCheckHook
42 pytest-mock
43 qemu
44 ];
45
46 prePatch = ''
47 # argparse is part of the standardlib
48 substituteInPlace setup.py \
49 --replace "'argparse'," ""
50 '';
51
52 disabledTests = [
53 # Many tests require network access and/or ovftool (https://code.vmware.com/web/tool/ovf)
54 # try enabling these tests with ovftool once/if it is added to nixpkgs
55 "HelperGenericTest"
56 "TestCOTAddDisk"
57 "TestCOTAddFile"
58 "TestCOTEditHardware"
59 "TestCOTEditProduct"
60 "TestCOTEditProperties"
61 "TestCOTInjectConfig"
62 "TestISO"
63 "TestOVFAPI"
64 "TestQCOW2"
65 "TestRAW"
66 "TestVMDKConversion"
67 # CLI test fails with AssertionError
68 "test_help"
69 # Failing TestCOTDeployESXi tests
70 "test_serial_fixup_stubbed"
71 "test_serial_fixup_stubbed_create"
72 "test_serial_fixup_stubbed_vm_not_found"
73 ] ++ lib.optionals stdenv.isDarwin [
74 "test_serial_fixup_invalid_host"
75 ];
76
77 pythonImportsCheck = [
78 "COT"
79 ];
80
81 meta = with lib; {
82 description = "Common OVF Tool";
83 longDescription = ''
84 COT (the Common OVF Tool) is a tool for editing Open Virtualization Format (.ovf, .ova) virtual appliances,
85 with a focus on virtualized network appliances such as the Cisco CSR 1000V and Cisco IOS XRv platforms.
86 '';
87 homepage = "https://github.com/glennmatthews/cot";
88 license = licenses.mit;
89 maintainers = with maintainers; [ evanjs ];
90 };
91}