Skip to content

Commit 40e69ac

Browse files
reload deprecated pkg_resources to bust cache in case just-installed package uses it internally
1 parent b7c1b9a commit 40e69ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

davos/core/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,13 @@ def smuggle(
10771077
# invalidate sys.meta_path module finder caches. Forces import
10781078
# machinery to notice newly installed module
10791079
importlib.invalidate_caches()
1080+
# if pkg_resources module has already been loaded, reload it in
1081+
# case the just-installed package uses it internally to populate
1082+
# its __version__ attribute from its metadata, Otherwise,
1083+
# pkg_resources's cached working set won't include the new
1084+
# package
1085+
if 'pkg_resources' in sys.modules:
1086+
importlib.reload(sys.modules['pkg_resources'])
10801087
# check whether the smuggled package and/or any
10811088
# installed/updated dependencies were already imported during
10821089
# the current runtime

0 commit comments

Comments
 (0)