Adjust the awx-manage script to make use of importlib (#15015)

* Adjust the awx-manage script to make use of importlib

removing the deprecation warning.

* Synlink awx-manage in docker-compose

No longer need to rebuild docker-compose devel image to load change for `tools/docker-compose/awx-manage` in development environment

---------

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>
This commit is contained in:
Jeff Bradberry
2024-04-02 17:20:05 -04:00
committed by GitHub
parent 7cdf1c7f96
commit 3edaaebba2
2 changed files with 14 additions and 4 deletions

View File

@@ -1,8 +1,17 @@
#!/usr/bin/awx-python
# EASY-INSTALL-ENTRY-SCRIPT: 'awx','console_scripts','awx-manage'
import sys
from pkg_resources import load_entry_point
__requires__ = 'awx'
from importlib.metadata import distribution
def load_entry_point(dist, group, name):
dist_name, _, _ = dist.partition('==')
matches = (
entry_point
for entry_point in distribution(dist_name).entry_points
if entry_point.group == group and entry_point.name == name
)
return next(matches).load()
if __name__ == '__main__':
sys.exit(