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