Skip to content

Commit

Permalink
Merge pull request #327408 from superherointj/linode-cli-4.176.0
Browse files Browse the repository at this point in the history
linode-cli: 4.166.0 -> 4.176.0
  • Loading branch information
superherointj authored Jul 15, 2024
2 parents 91c1f02 + 050f873 commit 716331f
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 37 deletions.
44 changes: 44 additions & 0 deletions pkgs/development/python-modules/linode-metadata/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
buildPythonPackage,
fetchPypi,
httpx,
lib,
linode-cli,
pytest,
pytest-asyncio,
setuptools,
}:

buildPythonPackage rec {
pname = "linode-metadata";
version = "0.3.0";

src = fetchPypi {
pname = "linode_metadata";
inherit version;
hash = "sha256-ZFCv9f4hbiBaJuKvzs/BGFoP+mAFwVa8OFF22b22voI=";
};

pyproject = true;

dependencies = [
httpx
setuptools
];

checkInputs = [
pytest
pytest-asyncio
];

pythonImportsCheck = [ "linode_metadata" ];

meta = {
description = "Python package for interacting with the Linode Metadata Service";
downloadPage = "https://pypi.org/project/linode-metadata/";
homepage = "https://github.com/linode/py-metadata";
changelog = "https://github.com/linode/py-metadata/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = linode-cli.meta.maintainers;
};
}
83 changes: 46 additions & 37 deletions pkgs/tools/virtualization/linode-cli/default.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{ lib
, fetchFromGitHub
, fetchurl
, buildPythonApplication
, colorclass
, installShellFiles
, pyyaml
, requests
, setuptools
, terminaltables
, rich
, openapi3
, packaging
{
buildPythonApplication,
colorclass,
fetchPypi,
fetchurl,
installShellFiles,
lib,
linode-metadata,
openapi3,
packaging,
pyyaml,
requests,
rich,
setuptools,
terminaltables,
}:

let
hash = "sha256-J0L+FTVzYuAqTDOwpoH12lQr03UNo5dsQpd/iUKR40Q=";
hash = "sha256-IXltDBgabTBDw0y7IXgRGpAWVUyqeJI8EfxkZ5YuQrU=";
# specVersion taken from: https://www.linode.com/docs/api/openapi.yaml at `info.version`.
specVersion = "4.166.0";
specHash = "sha256-rUwKQt3y/ALZUoW3eJiiIDJYLQpUHO7Abm0h09ra02g=";
specVersion = "4.176.0";
specHash = "sha256-P1E8Ga5ckrsw/CX0kxFef5fe8/p/pDCLuleX9wR5l48=";
spec = fetchurl {
url = "https://raw.githubusercontent.com/linode/linode-api-docs/v${specVersion}/openapi.yaml";
hash = specHash;
Expand All @@ -27,28 +29,34 @@ in

buildPythonApplication rec {
pname = "linode-cli";
version = "5.45.0";
version = "5.50.0";
pyproject = true;

src = fetchFromGitHub {
owner = "linode";
repo = pname;
rev = "v${version}";
inherit hash;
src = fetchPypi {
pname = "linode_cli";
inherit version;
hash = "sha256-OCnO7Bf2tDnC4g7kYS0WFlV9plAS25GbzRO6mpDYYxk=";
};

patches = [
./remove-update-check.patch
];
patches = [ ./remove-update-check.patch ];

# remove need for git history
prePatch = ''
substituteInPlace setup.py \
--replace "version = get_version()" "version='${version}',"
'';

postConfigure = ''
python3 -m linodecli bake ${spec} --skip-config
cp data-3 linodecli/
echo "${version}" > baked_version
'';

nativeBuildInputs = [ installShellFiles ];

propagatedBuildInputs = [
colorclass
linode-metadata
pyyaml
requests
setuptools
Expand All @@ -58,29 +66,30 @@ buildPythonApplication rec {
packaging
];

postConfigure = ''
python3 -m linodecli bake ${spec} --skip-config
cp data-3 linodecli/
echo "${version}" > baked_version
'';

doInstallCheck = true;
installCheckPhase = ''
$out/bin/linode-cli --skip-config --version | grep ${version} > /dev/null
'';

nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd linode-cli --bash <($out/bin/linode-cli --skip-config completion bash)
for shell in bash fish; do
installShellCompletion --cmd linode-cli \
--$shell <($out/bin/linode-cli --skip-config completion $shell)
done
'';

passthru.updateScript = ./update.sh;

meta = with lib; {
mainProgram = "linode-cli";
meta = {
description = "Linode Command Line Interface";
changelog = "https://github.com/linode/linode-cli/releases/tag/v${version}";
downloadPage = "https://pypi.org/project/linode-cli";
homepage = "https://github.com/linode/linode-cli";
license = licenses.bsd3;
maintainers = with maintainers; [ ryantm techknowlogick ];
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
ryantm
techknowlogick
];
mainProgram = "linode-cli";
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6996,6 +6996,8 @@ self: super: with self; {

linode-api = callPackage ../development/python-modules/linode-api { };

linode-metadata = callPackage ../development/python-modules/linode-metadata { };

linode = callPackage ../development/python-modules/linode { };

linuxfd = callPackage ../development/python-modules/linuxfd { };
Expand Down

0 comments on commit 716331f

Please sign in to comment.