1{ lib, stdenv, buildPythonPackage, fetchPypi, pythonOlder, isPy3k
2, colorlog, pyvmomi, requests, verboselogs
3, psutil, pyopenssl, setuptools
4, mock, pytest-mock, pytestCheckHook, qemu
5}:
6
7buildPythonPackage rec {
8 pname = "cot";
9 version = "2.2.1";
10 disabled = !isPy3k;
11
12 src = fetchPypi {
13 inherit pname version;
14 sha256 = "f4b3553415f90daac656f89d3e82e79b3d751793239bb173a683b4cc0ceb2635";
15 };
16
17 propagatedBuildInputs = [ colorlog pyvmomi requests verboselogs pyopenssl setuptools ]
18 ++ lib.optional (pythonOlder "3.3") psutil;
19
20 checkInputs = [ mock pytestCheckHook pytest-mock qemu ];
21
22 # Many tests require network access and/or ovftool (https://code.vmware.com/web/tool/ovf)
23 # try enabling these tests with ovftool once/if it is added to nixpkgs
24 disabledTests = [
25 "HelperGenericTest"
26 "TestCOTAddDisk"
27 "TestCOTAddFile"
28 "TestCOTEditHardware"
29 "TestCOTEditProduct"
30 "TestCOTEditProperties"
31 "TestCOTInjectConfig"
32 "TestISO"
33 "TestOVFAPI"
34 "TestQCOW2"
35 "TestRAW"
36 "TestVMDKConversion"
37 ] ++ lib.optionals stdenv.isDarwin [
38 "test_serial_fixup_invalid_host"
39 ];
40
41 # argparse is part of the standardlib
42 prePatch = ''
43 substituteInPlace setup.py --replace "'argparse'," ""
44 '';
45
46 meta = with lib; {
47 description = "Common OVF Tool";
48 longDescription = ''
49 COT (the Common OVF Tool) is a tool for editing Open Virtualization Format (.ovf, .ova) virtual appliances,
50 with a focus on virtualized network appliances such as the Cisco CSR 1000V and Cisco IOS XRv platforms.
51 '';
52 homepage = "https://github.com/glennmatthews/cot";
53 license = licenses.mit;
54 maintainers = with maintainers; [ evanjs ];
55 };
56}