Bust import caching of xstatic package namespaces

When iterating over xstatic packages which haven't had the benefit
of pip install creating explicit namespace packages for them, we
reset the implicit namespaces which may linger from earlier imports.

Change-Id: Ie6fe282c9d06f0147e37bbe2cf6de9d9c3f0eb39
This commit is contained in:
Jeremy Stanley 2020-03-26 20:07:34 +00:00
parent 97860919df
commit 7936adc658

View File

@ -35,6 +35,12 @@ def get_versions(workdir, repo):
if '__' in name:
continue
if os.path.isdir('xstatic/pkg/%s' % name):
# import cache buster, since these namespaces can linger
import xstatic
import xstatic.pkg
importlib.reload(xstatic)
importlib.reload(xstatic.pkg)
xs = importlib.import_module('xstatic.pkg.%s' % name)
versions.append(xs.PACKAGE_VERSION)
finally: