1{
2 lib,
3 buildPythonPackage,
4 colorlog,
5 fetchPypi,
6 mock,
7 pyopenssl,
8 pytest-mock,
9 pytestCheckHook,
10 pythonAtLeast,
11 pythonOlder,
12 pyvmomi,
13 qemu,
14 requests,
15 setuptools,
16 stdenv,
17 verboselogs,
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 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 [ "test_serial_fixup_invalid_host" ];
74
75 pythonImportsCheck = [ "COT" ];
76
77 meta = {
78 homepage = "https://github.com/glennmatthews/cot";
79 description = "Common OVF Tool";
80 mainProgram = "cot";
81 longDescription = ''
82 COT (the Common OVF Tool) is a tool for editing Open Virtualization Format
83 (.ovf, .ova) virtual appliances, with a focus on virtualized network
84 appliances such as the Cisco CSR 1000V and Cisco IOS XRv platforms.
85 '';
86 license = lib.licenses.mit;
87 maintainers = with lib.maintainers; [ evanjs ];
88 broken = pythonAtLeast "3.12"; # Because it requires packages removed from 3.12 onwards
89 };
90}