From 7936adc658d4ae5df68aa8d2f6abce838c1974a3 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 26 Mar 2020 20:07:34 +0000 Subject: [PATCH] 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 --- openstack_releases/xstaticutils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openstack_releases/xstaticutils.py b/openstack_releases/xstaticutils.py index 5cc12db05c..64179d523a 100644 --- a/openstack_releases/xstaticutils.py +++ b/openstack_releases/xstaticutils.py @@ -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: