@@ -0,0 +1,56 @@
1+{ stdenv, buildPythonPackage, fetchPypi, pythonOlder, isPy3k
2+, argcomplete, colorlog, pyvmomi, requests, verboselogs
3+, psutil, pyopenssl, setuptools
4+, mock, pytest, pytest-mock, pytestCheckHook, qemu
5+}:
6+
7+buildPythonPackage rec {
8+ pname = "cot";
9+ version = "2.2.1";
10+
11+ disabled = !isPy3k;
12+
13+ src = fetchPypi {
14+ inherit pname version;
15+ sha256 = "f4b3553415f90daac656f89d3e82e79b3d751793239bb173a683b4cc0ceb2635";
16+ };
17+
18+ propagatedBuildInputs = [ colorlog pyvmomi requests verboselogs pyopenssl setuptools ]
19+ ++ stdenv.lib.optional (pythonOlder "3.3") psutil;
20+
21+ checkInputs = [ mock pytestCheckHook pytest-mock qemu ];
22+
23+ # Many tests require network access and/or ovftool (https://code.vmware.com/web/tool/ovf)
24+ # try enabling these tests with ovftool once/if it is added to nixpkgs
25+ disabledTests = [
26+ "HelperGenericTest"
27+ "TestCOTAddDisk"
28+ "TestCOTAddFile"
29+ "TestCOTEditHardware"
30+ "TestCOTEditProduct"
31+ "TestCOTEditProperties"
32+ "TestCOTInjectConfig"
33+ "TestISO"
34+ "TestOVFAPI"
35+ "TestQCOW2"
36+ "TestRAW"
37+ "TestVMDKConversion"
38+ ];
39+
40+
41+ # argparse is part of the standardlib
42+ prePatch = ''
43+ substituteInPlace setup.py --replace "'argparse'," ""
44+ '';
45+
46+ meta = with stdenv.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+}