Skip to content

Commit

Permalink
fix deprecated pkg_resources and support zipapp
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed May 22, 2024
1 parent 176724c commit d433bb1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions hpy/devel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,21 @@ def handle_hpy_ext_modules(dist, attr, hpy_ext_modules):
# This file is automatically generated by hpy
def __bootstrap__():
from sys import modules
from sys import modules, version_info
from os import environ
from pkg_resources import resource_filename
from contextlib import nullcontext
from importlib import resources
from hpy.universal import _load_bootstrap
ext_filepath = resource_filename(__name__, {ext_file!r})
m = _load_bootstrap({module_name!r}, __name__, __package__, ext_filepath,
__loader__, __spec__, environ)
if version_info < (3, 9):
ctx = resources.path(__package__, {ext_file!r})
else:
ctx = nullcontext(resources.files(__package__).joinpath({ext_file!r}))
with ctx as ext_filepath:
m = _load_bootstrap({module_name!r}, __name__, __package__, str(ext_filepath),
__loader__, __spec__, environ)
modules[__name__] = m
__bootstrap__()
Expand Down

0 comments on commit d433bb1

Please sign in to comment.