Drop usage of importlib_metadata
This is follow-up of b7fe561d09
and use
TypeError caused by the interface change as the key, instead of python
versions, which may work better for distributions with own feature
backports.
Change-Id: I84113cf1dc4de0481c9878a83e2dcd99a8fe69b9
This commit is contained in:
parent
0ac6cbec75
commit
969de2944a
@ -10,22 +10,26 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import sys
|
from importlib.metadata import entry_points
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron._i18n import _
|
from neutron._i18n import _
|
||||||
|
|
||||||
if sys.version_info < (3, 10, 0):
|
|
||||||
from importlib_metadata import entry_points
|
|
||||||
else:
|
|
||||||
from importlib.metadata import entry_points
|
|
||||||
|
|
||||||
MIGRATION_ENTRYPOINTS = 'neutron.db.alembic_migrations'
|
MIGRATION_ENTRYPOINTS = 'neutron.db.alembic_migrations'
|
||||||
migration_entrypoints = {
|
|
||||||
entrypoint.name: entrypoint
|
try:
|
||||||
for entrypoint in entry_points(group=MIGRATION_ENTRYPOINTS)
|
migration_entrypoints = {
|
||||||
}
|
entrypoint.name: entrypoint
|
||||||
|
for entrypoint in entry_points(group=MIGRATION_ENTRYPOINTS)
|
||||||
|
}
|
||||||
|
except TypeError:
|
||||||
|
# For python < 3.10
|
||||||
|
migration_entrypoints = {
|
||||||
|
entrypoint.name: entrypoint
|
||||||
|
for entrypoint in entry_points()[MIGRATION_ENTRYPOINTS]
|
||||||
|
}
|
||||||
|
|
||||||
INSTALLED_SUBPROJECTS = list(migration_entrypoints)
|
INSTALLED_SUBPROJECTS = list(migration_entrypoints)
|
||||||
|
|
||||||
|
@ -56,6 +56,3 @@ python-designateclient>=2.7.0 # Apache-2.0
|
|||||||
os-vif>=3.1.0 # Apache-2.0
|
os-vif>=3.1.0 # Apache-2.0
|
||||||
futurist>=1.2.0 # Apache-2.0
|
futurist>=1.2.0 # Apache-2.0
|
||||||
tooz>=1.58.0 # Apache-2.0
|
tooz>=1.58.0 # Apache-2.0
|
||||||
|
|
||||||
# TODO(tkajinam): Remove importlib_metadata when python 3.9 support is dropped
|
|
||||||
importlib_metadata>=3.6;python_version<"3.10" # Apache-2.0
|
|
||||||
|
Loading…
Reference in New Issue
Block a user