Merge pull request #243184 from ianliu/master

This commit is contained in:
Artturi
2023-07-16 02:46:32 +03:00
committed by GitHub
3 changed files with 21 additions and 77 deletions
+21 -37
View File
@@ -6,30 +6,32 @@
python3.pkgs.buildPythonApplication rec {
pname = "aws-sam-cli";
version = "1.53.0";
version = "1.90.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-kIW+aGYuS+JgOMsPbeLgPSgLFNKLSqHaZ1CHpjs/IVI=";
hash = "sha256-JXUfc37O6cTTOCTTtWE05m+GR4iDyBsmRPyXoTRxFmo=";
};
propagatedBuildInputs = with python3.pkgs; [
aws-lambda-builders
aws-sam-translator
boto3
cfn-lint
chevron
click
cookiecutter
dateparser
python-dateutil
docker
flask
jmespath
requests
pyopenssl
pyyaml
rich
ruamel-yaml
serverlessrepo
tomlkit
watchdog
typing-extensions
regex
tzlocal
watchdog
];
postFixup = if enableTelemetry then "echo aws-sam-cli TELEMETRY IS ENABLED" else ''
@@ -37,39 +39,21 @@ python3.pkgs.buildPythonApplication rec {
wrapProgram $out/bin/sam --set SAM_CLI_TELEMETRY 0
'';
patches = [
# Click 8.1 removed `get_terminal_size`, recommending
# `shutil.get_terminal_size` instead.
# (https://github.com/pallets/click/pull/2130)
./support-click-8-1.patch
# Werkzeug >= 2.1.0 breaks the `sam local start-lambda` command because
# aws-sam-cli uses a "WERKZEUG_RUN_MAIN" hack to suppress flask output.
# (https://github.com/cs01/gdbgui/issues/425)
./use_forward_compatible_log_silencing.patch
];
# fix over-restrictive version bounds
postPatch = ''
substituteInPlace requirements/base.txt \
--replace "aws_lambda_builders==" "aws-lambda-builders #" \
--replace "aws-sam-translator==1.46.0" "aws-sam-translator~=1.46" \
--replace "click~=7.1" "click~=8.1" \
--replace "cookiecutter~=1.7.2" "cookiecutter>=1.7.2" \
--replace "dateparser~=1.0" "dateparser>=0.7" \
--replace "docker~=4.2.0" "docker>=4.2.0" \
--replace "Flask~=1.1.4" "Flask~=2.0" \
--replace "jmespath~=0.10.0" "jmespath" \
--replace "MarkupSafe==2.0.1" "MarkupSafe #" \
--replace "PyYAML~=5.3" "PyYAML #" \
--replace "regex==" "regex #" \
--replace "requests==" "requests #" \
--replace "typing_extensions==" "typing-extensions #" \
--replace "tzlocal==3.0" "tzlocal #" \
--replace "tomlkit==0.7.2" "tomlkit #" \
--replace "watchdog==" "watchdog #"
--replace 'PyYAML>=' 'PyYAML>=5.4.1 #' \
--replace 'aws-sam-translator==1.70.0' 'aws-sam-translator>=1.60.1' \
--replace 'boto3>=' 'boto3>=1.26.79 #' \
--replace 'cfn-lint~=0.77.9' 'cfn-lint~=0.73.2' \
--replace 'docker~=6.1.0' 'docker~=6.0.1' \
--replace 'pyopenssl~=23.2.0' 'pyopenssl~=23.1.0' \
--replace 'ruamel_yaml~=0.17.32' 'ruamel_yaml~=0.17.21' \
--replace 'tomlkit==0.11.8' 'tomlkit~=0.11.6' \
--replace 'typing_extensions~=4.4.0' 'typing_extensions~=4.4' \
--replace 'tzlocal==3.0' 'tzlocal>=3.0' \
--replace 'watchdog==' 'watchdog>=2.1.2 #'
'';
# Tests are not included in the PyPI package
doCheck = false;
meta = with lib; {
@@ -1,21 +0,0 @@
diff --git a/samcli/commands/_utils/table_print.py b/samcli/commands/_utils/table_print.py
index de63af29..a9d0f2fe 100644
--- a/samcli/commands/_utils/table_print.py
+++ b/samcli/commands/_utils/table_print.py
@@ -7,6 +7,7 @@ from functools import wraps
from typing import Sized
import click
+import shutil
MIN_OFFSET = 20
@@ -30,7 +31,7 @@ def pprint_column_names(
def pprint_wrap(func):
# Calculate terminal width, number of columns in the table
- width, _ = click.get_terminal_size()
+ width, _ = shutil.get_terminal_size()
# For UX purposes, set a minimum width for the table to be usable
# and usable_width keeps margins in mind.
width = max(width, min_width)
@@ -1,19 +0,0 @@
diff --git a/samcli/local/services/base_local_service.py b/samcli/local/services/base_local_service.py
index 7b1ab95895d1..76812f02e00a 100644
--- a/samcli/local/services/base_local_service.py
+++ b/samcli/local/services/base_local_service.py
@@ -56,9 +56,11 @@ class BaseLocalService:
LOG.debug("Localhost server is starting up. Multi-threading = %s", multi_threaded)
- # This environ signifies we are running a main function for Flask. This is true, since we are using it within
- # our cli and not on a production server.
- os.environ["WERKZEUG_RUN_MAIN"] = "true"
+ # Suppress flask dev server output in a forward-compatible way
+ # Source: https://github.com/cs01/gdbgui/issues/425#issuecomment-1119836533
+ import flask.cli
+
+ flask.cli.show_server_banner = lambda *args: None
self._app.run(threaded=multi_threaded, host=self.host, port=self.port)