depot/third_party/nixpkgs/pkgs/tools/virtualization/linode-cli/default.nix
Default email 1a0302a145 Project import generated by Copybara.
GitOrigin-RevId: 311ceed827f531f88f46222920cd1ebb2c101f73
2021-04-12 20:23:04 +02:00

61 lines
1.2 KiB
Nix

{ lib
, buildPythonApplication
, fetchFromGitHub
, fetchurl
, terminaltables
, colorclass
, requests
, pyyaml
, setuptools
}:
let
spec = fetchurl {
url = "https://raw.githubusercontent.com/linode/linode-api-docs/v4.89.0/openapi.yaml";
sha256 = "sha256-R7Dmq8ifGEjh47ftuoGrbymYBsPCj/ULz0j1OqJDcwY=";
};
in
buildPythonApplication rec {
pname = "linode-cli";
version = "5.0.1";
src = fetchFromGitHub {
owner = "linode";
repo = pname;
rev = version;
sha256 = "sha256-zelopRaHaDCnbYA/y7dNMBh70g0+wuc6t9LH/VLaUIk=";
};
# remove need for git history
prePatch = ''
substituteInPlace setup.py \
--replace "version=get_version()," "version='${version}',"
'';
propagatedBuildInputs = [
terminaltables
colorclass
requests
pyyaml
setuptools
];
postConfigure = ''
python3 -m linodecli bake ${spec} --skip-config
cp data-3 linodecli/
'';
# 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 ];
};
}