Suppress pkg_resources deprecation warning on Alpine Docker builds#10095
Open
fresh3nough wants to merge 1 commit intoaws:v2from
Open
Suppress pkg_resources deprecation warning on Alpine Docker builds#10095fresh3nough wants to merge 1 commit intoaws:v2from
fresh3nough wants to merge 1 commit intoaws:v2from
Conversation
Remove outdated pkg_resources.py2_warn hidden import from the PyInstaller hook for awscli. This hidden import was a workaround for pypa/setuptools#1963 which has been resolved in PyInstaller 5.5+. Add a PyInstaller runtime hook to suppress the UserWarning emitted by setuptools >= 81 when pkg_resources is imported at runtime. This prevents the deprecation warning from appearing in CLI output when building the v2 CLI from source with newer setuptools versions. Fixes aws#10065
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #10065
Description
Building AWS CLI v2 from source on Alpine Docker with setuptools >= 81 produces a
UserWarningat runtime:This change addresses two root causes:
Removes the outdated
pkg_resources.py2_warnhidden import fromexe/pyinstaller/hook-awscli.py. This hidden import was a workaround for pypa/setuptools#1963, which has been resolved upstream in PyInstaller 5.5+ (see pyinstaller/pyinstaller#6952). Thepy2_warnmodule was removed from setuptools around version 49.Adds a PyInstaller runtime hook (
pyi_rth_pkg_resources_warning.py) that suppresses theUserWarningemitted by setuptools >= 81 whenpkg_resourcesis imported at runtime. This hook is registered in bothaws.specandaws_completer.spec.Steps to Reproduce the Issue
Build the CLI on Alpine Docker using the following Dockerfile:
Before this fix, the final command outputs:
Steps to Verify the Fix
Build with the same Dockerfile, replacing the git clone branch with this PR branch. The warning should no longer appear in the output of
/aws-cli-bin/aws --version.Changes
exe/pyinstaller/hook-awscli.py: Removedpkg_resources.py2_warnfrom hidden importsexe/pyinstaller/pyi_rth_pkg_resources_warning.py: New runtime hook to filter the deprecation warningexe/pyinstaller/aws.spec: Added runtime hook referenceexe/pyinstaller/aws_completer.spec: Added runtime hook reference