Skip to content

Commit

Permalink
Use files API on Python 3.9 and later. Fixes #140.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 13, 2022
1 parent c45334a commit 9e25496
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pep517/in_process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@

try:
import importlib.resources as resources

def _in_proc_script_path():
return resources.path(__package__, '_in_process.py')
try:
resources.files
except AttributeError:
# Python 3.8 compatibility
def _in_proc_script_path():
return resources.path(__package__, '_in_process.py')
else:
def _in_proc_script_path():
return resources.as_file(
resources.files(__package__).joinpath('_in_process.py'))
except ImportError:
# Python 3.6 compatibility
@contextmanager
def _in_proc_script_path():
yield pjoin(dirname(abspath(__file__)), '_in_process.py')

0 comments on commit 9e25496

Please sign in to comment.