awsebcli: refactor, relax dependencies, and enable tests

This commit is contained in:
Theodore Ni 2023-07-21 19:19:10 -07:00 committed by Martin Weinelt
parent 10fd6d034b
commit 0f23a142ec

View File

@ -1,4 +1,4 @@
{ lib, python3, fetchPypi, glibcLocales, docker-compose_1 }:
{ lib, python3, fetchFromGitHub, glibcLocales, docker-compose_1, git }:
let
docker_compose = changeVersion (with localPython.pkgs; docker-compose_1.override {
inherit colorama pyyaml six dockerpty docker jsonschema requests websocket-client paramiko;
@ -18,56 +18,29 @@ let
cement = changeVersion super.cement.overridePythonAttrs "2.8.2" "sha256-h2XtBSwGHXTk0Bia3cM9Jo3lRMohmyWdeXdB9yXkItI=";
wcwidth = changeVersion super.wcwidth.overridePythonAttrs "0.1.9" "sha256-7nOGKGKhVr93/5KwkDT8SCXdOvnPgbxbNgZo1CXzxfE=";
semantic-version = changeVersion super.semantic-version.overridePythonAttrs "2.8.5" "sha256-0sst4FWHYpNGebmhBOguynr0SMn0l00fPuzP9lHfilQ=";
pyyaml = super.pyyaml.overridePythonAttrs rec {
version = "5.4.1";
checkPhase = ''
runHook preCheck
PYTHONPATH="tests/lib3:$PYTHONPATH" ${localPython.interpreter} -m test_all
runHook postCheck
'';
src = fetchPypi {
pname = "PyYAML";
inherit version;
hash = "sha256-YHd0y7oocyv6gCtUuqdIQhX1MJkQVbtWLvvtWy8gpF4=";
};
};
};
};
in
with localPython.pkgs; buildPythonApplication rec {
pname = "awsebcli";
version = "3.20.7";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-hnLWqc4UzUnvz4wmKZ8JcEWUMPmh2BdQS1IAyxC+yb4=";
src = fetchFromGitHub {
owner = "aws";
repo = "aws-elastic-beanstalk-cli";
rev = "refs/tags/${version}";
hash = "sha256-DxjoEkFnY4aSfxVKPpnJLmnjLtZnlM74XXd0K8mcdoY=";
};
preConfigure = ''
substituteInPlace requirements.txt \
--replace "six>=1.11.0,<1.15.0" "six==1.16.0" \
--replace "pathspec==0.10.1" "pathspec>=0.10.0,<1" \
--replace "colorama>=0.2.5,<0.4.4" "colorama>=0.2.5,<=0.4.6" \
--replace "termcolor == 1.1.0" "termcolor>=2.0.0,<3"
'';
nativeBuildInputs = [
pythonRelaxDepsHook
];
buildInputs = [
glibcLocales
];
nativeCheckInputs = [
pytest
mock
nose
pathspec
colorama
requests
docutils
];
doCheck = true;
propagatedBuildInputs = [
blessed
botocore
@ -85,6 +58,38 @@ with localPython.pkgs; buildPythonApplication rec {
docker_compose
];
pythonRelaxDeps = [
"botocore"
"colorama"
"pathspec"
"PyYAML"
"six"
"termcolor"
];
nativeCheckInputs = [
pytestCheckHook
pytest-socket
mock
git
];
pytestFlagsArray = [
"tests/unit"
];
disabledTests = [
# Needs docker installed to run.
"test_local_run"
"test_local_run__with_arguments"
# Needs access to the user's ~/.ssh directory.
"test_generate_and_upload_keypair__exit_code_0"
"test_generate_and_upload_keypair__exit_code_1"
"test_generate_and_upload_keypair__exit_code_is_other_than_1_and_0"
"test_generate_and_upload_keypair__ssh_keygen_not_present"
];
meta = with lib; {
homepage = "https://aws.amazon.com/elasticbeanstalk/";
description = "A command line interface for Elastic Beanstalk";