Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staticx: Use importlib.resources over pkg_resources for asset access #274

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

JonathonReinhart
Copy link
Owner

@JonathonReinhart JonathonReinhart commented Jan 14, 2024

Replace pkg_resources.resource_stream() with importlib_resources.files().joinpath().open().

Fixes #266 (again).

@JonathonReinhart JonathonReinhart force-pushed the 266-pkg_resources-again-use-backport branch from 0cec14f to 0379caa Compare January 14, 2024 05:56
pkg_resources is deprecated:
https://setuptools.pypa.io/en/latest/pkg_resources.html

This instead uses importlib.resources.files() (introduced in Python 3.9)
and uses the backport importlib_resources for Python 3.7-3.8 (to be
removed in #264, #265).

This was chosen over the alternative of using the deprecated (as of
Python 3.11) function importlib.resources.open_binary() (introduced in
Python 3.7), since we already have techdebt to remove a related
backport, which is preferable to upgrading from the deprecated API.
@JonathonReinhart JonathonReinhart force-pushed the 266-pkg_resources-again-use-backport branch from 0379caa to 81fa8fe Compare January 14, 2024 06:01
@JonathonReinhart JonathonReinhart merged commit 2a8214e into main Jan 14, 2024
13 checks passed
@JonathonReinhart JonathonReinhart deleted the 266-pkg_resources-again-use-backport branch January 14, 2024 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of pkg_resources
1 participant