diff options
author | Mel Bourgeois <mason.bourgeois@gmail.com> | 2022-09-04 09:21:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 16:21:01 +0200 |
commit | 0644bf43617a97f691c7f2b7bf14f4f01441f753 (patch) | |
tree | a1faa0bf69be65a4c8af083aa3e3d06d706f28f4 | |
parent | 5518e6aba11f50f0953fa21c7ad6a283c4741b95 (diff) | |
download | nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar.gz nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar.bz2 nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar.lz nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar.xz nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.tar.zst nixpkgs-0644bf43617a97f691c7f2b7bf14f4f01441f753.zip |
aws-sam-cli: fix local command for Werkzeug>=2.1.0 (#182750)
-rw-r--r-- | pkgs/development/tools/aws-sam-cli/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/aws-sam-cli/use_forward_compatible_log_silencing.patch | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/development/tools/aws-sam-cli/default.nix b/pkgs/development/tools/aws-sam-cli/default.nix index 3c9c81a625c..3802e2ee1c7 100644 --- a/pkgs/development/tools/aws-sam-cli/default.nix +++ b/pkgs/development/tools/aws-sam-cli/default.nix @@ -41,6 +41,10 @@ python3.pkgs.buildPythonApplication rec { # `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 diff --git a/pkgs/development/tools/aws-sam-cli/use_forward_compatible_log_silencing.patch b/pkgs/development/tools/aws-sam-cli/use_forward_compatible_log_silencing.patch new file mode 100644 index 00000000000..76297875f36 --- /dev/null +++ b/pkgs/development/tools/aws-sam-cli/use_forward_compatible_log_silencing.patch @@ -0,0 +1,19 @@ +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) + |