5
5
import typing as t
6
6
from glob import glob
7
7
8
- import pkg_resources
8
+ import importlib_resources
9
9
from tutor import fmt
10
- from tutor .__about__ import __version_suffix__
11
10
from tutor import hooks as tutor_hooks
11
+ from tutor .__about__ import __version_suffix__
12
12
from tutor .hooks import priorities
13
13
from tutor .types import Config , get_typed
14
14
@@ -168,11 +168,14 @@ def _mounted_mfe_image_management() -> None:
168
168
# init script
169
169
with open (
170
170
os .path .join (
171
- pkg_resources .resource_filename ("tutormfe" , "templates" ),
172
- "mfe" ,
173
- "tasks" ,
174
- "lms" ,
175
- "init" ,
171
+ str (
172
+ importlib_resources .files ("tutormfe" )
173
+ / "templates"
174
+ / "mfe"
175
+ / "tasks"
176
+ / "lms"
177
+ / "init"
178
+ )
176
179
),
177
180
encoding = "utf-8" ,
178
181
) as task_file :
@@ -248,7 +251,7 @@ def _build_3rd_party_dev_mfes_on_launch(
248
251
# Boilerplate code
249
252
# Add the "templates" folder as a template root
250
253
tutor_hooks .Filters .ENV_TEMPLATE_ROOTS .add_item (
251
- pkg_resources . resource_filename ("tutormfe" , "templates" )
254
+ str ( importlib_resources . files ("tutormfe" ) / "templates" )
252
255
)
253
256
# Render the "build" and "apps" folders
254
257
tutor_hooks .Filters .ENV_TEMPLATE_TARGETS .add_items (
@@ -258,12 +261,7 @@ def _build_3rd_party_dev_mfes_on_launch(
258
261
],
259
262
)
260
263
# Load patches from files
261
- for path in glob (
262
- os .path .join (
263
- pkg_resources .resource_filename ("tutormfe" , "patches" ),
264
- "*" ,
265
- )
266
- ):
264
+ for path in glob (str (importlib_resources .files ("tutormfe" ) / "patches" / "*" )):
267
265
with open (path , encoding = "utf-8" ) as patch_file :
268
266
# Here we force tutor-mfe lms patches to be loaded first, thus ensuring when operators override
269
267
# MFE_CONFIG and/or MFE_CONFIG_OVERRIDES, their patches will be loaded after this plugin's
0 commit comments