Skip to content

Commit

Permalink
Do not use deprecated API
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
  • Loading branch information
gaborbernat committed Nov 23, 2022
1 parent e6925a6 commit 0b52227
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/virtualenv/activation/via_template.py
Expand Up @@ -4,10 +4,17 @@

from .activator import Activator

if sys.version_info >= (3, 7):
from importlib.resources import read_binary
if sys.version_info >= (3, 9) or sys.version_info <= (3, 7):
if sys.version_info >= (3, 9):
from importlib.resources import files
else:
from importlib_resources import files

def read_binary(module_name: str, filename: str) -> bytes:
return (files(module_name) / filename).read_bytes()

else:
from importlib_resources import read_binary
from importlib.resources import read_binary


class ViaTemplateActivator(Activator, metaclass=ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -67,7 +67,7 @@ setenv =
skip_install = true
deps =
coverage>=6.5
diff_cover>=7.0.1
diff_cover>=7.0.2
extras =
parallel_show_output = true
commands =
Expand Down

0 comments on commit 0b52227

Please sign in to comment.