Skip to content

Commit b95c953

Browse files
authored
pyinstaller: fix CI on py<3.10 (#244)
1 parent cbe7c28 commit b95c953

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pydrive2/__pyinstaller/test_hook-googleapiclient.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
from PyInstaller import __main__ as pyi_main
44

55

6-
_APP_SOURCE = """import importlib.resources
6+
# NOTE: importlib.resources.contents is available in py3.7+, but due to how
7+
# pyinstaller handles importlib, we need to use the importlib_resources
8+
# backport if there are any resources methods that are not available in a given
9+
# python version, which ends up being py<3.10
10+
_APP_SOURCE = """
11+
import sys
12+
if sys.version_info >= (3, 10):
13+
from importlib.resources import contents
14+
else:
15+
from importlib_resources import contents
716
817
import pydrive2.files
918
1019
11-
cache_files = importlib.resources.contents(
20+
cache_files = contents(
1221
"googleapiclient.discovery_cache.documents"
1322
)
1423
assert len(cache_files) > 0

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"flake8-docstrings",
1010
"pytest-mock",
1111
"pyinstaller",
12+
"importlib_resources; python_version < '3.10'",
1213
]
1314

1415
tests_requirements.append("black==22.10.0")

0 commit comments

Comments
 (0)