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