1{ lib
2, buildPythonApplication
3, fetchFromGitHub
4, fetchpatch
5, fetchurl
6, terminaltables
7, colorclass
8, requests
9, pyyaml
10, setuptools
11}:
12
13let
14
15 spec = fetchurl {
16 url = "https://raw.githubusercontent.com/linode/linode-api-docs/v4.67.0/openapi.yaml";
17 sha256 = "0vsblprkqlr9508x5rkm0wj6lc3w72xiwiqxia9asgr5k45hhfnr";
18 };
19
20in
21
22buildPythonApplication rec {
23 pname = "linode-cli";
24 version = "2.15.0";
25
26 src = fetchFromGitHub {
27 owner = "linode";
28 repo = pname;
29 rev = version;
30 sha256 = "06iz9xjj6h1ry176558488fl9j18a5vf724zh4cxlcksdy72dnna";
31 };
32
33 patches = [
34 # make enum34 depend on python version
35 ( fetchpatch {
36 url = "https://github.com/linode/linode-cli/pull/184/commits/4cf55759c5da33fbc49b9ba664698875d67d4f76.patch";
37 sha256 = "04n9a6yh0abyyymvfzajhav6qxwvzjl2vs8jnqp3yqrma7kl0slj";
38 })
39 ];
40
41 # remove need for git history
42 prePatch = ''
43 substituteInPlace setup.py \
44 --replace "version=get_version()," "version='${version}',"
45 '';
46
47 propagatedBuildInputs = [
48 terminaltables
49 colorclass
50 requests
51 pyyaml
52 setuptools
53 ];
54
55 postConfigure = ''
56 python3 -m linodecli bake ${spec} --skip-config
57 cp data-3 linodecli/
58 '';
59
60 # requires linode access token for unit tests, and running executable
61 doCheck = false;
62
63 meta = with lib; {
64 homepage = "https://github.com/linode/linode-cli";
65 description = "The Linode Command Line Interface";
66 license = licenses.bsd3;
67 maintainers = with maintainers; [ ryantm ];
68 };
69
70}