2020-04-15 00:49:00 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonApplication
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, fetchurl
|
|
|
|
, terminaltables
|
|
|
|
, colorclass
|
|
|
|
, requests
|
|
|
|
, pyyaml
|
|
|
|
, setuptools
|
|
|
|
}:
|
2017-05-01 17:58:54 +01:00
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
spec = fetchurl {
|
2020-06-23 21:30:51 +01:00
|
|
|
url = "https://raw.githubusercontent.com/linode/linode-api-docs/v4.67.0/openapi.yaml";
|
|
|
|
sha256 = "0vsblprkqlr9508x5rkm0wj6lc3w72xiwiqxia9asgr5k45hhfnr";
|
2020-04-15 00:49:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
buildPythonApplication rec {
|
2019-06-20 14:07:56 +01:00
|
|
|
pname = "linode-cli";
|
2020-06-23 21:30:51 +01:00
|
|
|
version = "2.15.0";
|
2017-05-01 17:58:54 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "linode";
|
2020-04-15 00:49:00 +01:00
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-06-23 21:30:51 +01:00
|
|
|
sha256 = "06iz9xjj6h1ry176558488fl9j18a5vf724zh4cxlcksdy72dnna";
|
2017-05-01 17:58:54 +01:00
|
|
|
};
|
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
patches = [
|
|
|
|
# make enum34 depend on python version
|
|
|
|
( fetchpatch {
|
|
|
|
url = "https://github.com/linode/linode-cli/pull/184/commits/4cf55759c5da33fbc49b9ba664698875d67d4f76.patch";
|
|
|
|
sha256 = "04n9a6yh0abyyymvfzajhav6qxwvzjl2vs8jnqp3yqrma7kl0slj";
|
|
|
|
})
|
2017-05-01 17:58:54 +01:00
|
|
|
];
|
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
# remove need for git history
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "version=get_version()," "version='${version}',"
|
2017-05-01 17:58:54 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
terminaltables
|
|
|
|
colorclass
|
|
|
|
requests
|
|
|
|
pyyaml
|
|
|
|
setuptools
|
|
|
|
];
|
2017-05-01 17:58:54 +01:00
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
postConfigure = ''
|
|
|
|
python3 -m linodecli bake ${spec} --skip-config
|
|
|
|
cp data-3 linodecli/
|
|
|
|
'';
|
2017-05-01 17:58:54 +01:00
|
|
|
|
2020-04-15 00:49:00 +01:00
|
|
|
# requires linode access token for unit tests, and running executable
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/linode/linode-cli";
|
|
|
|
description = "The Linode Command Line Interface";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ ryantm ];
|
2017-05-01 17:58:54 +01:00
|
|
|
};
|
2020-04-15 00:49:00 +01:00
|
|
|
|
2017-05-01 17:58:54 +01:00
|
|
|
}
|