Skip to content

Commit

Permalink
Merge pull request #144 from pypa/bugfix/140-resources-39
Browse files Browse the repository at this point in the history
Use files API on Python 3.9 and later.
  • Loading branch information
pradyunsg authored Jun 27, 2022
2 parents c45334a + 9e25496 commit ab27639
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 ab27639

Please sign in to comment.