summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Bradberry <jeff.bradberry@gmail.com>2024-04-02 23:20:05 +0200
committerGitHub <noreply@github.com>2024-04-02 23:20:05 +0200
commit3edaaebba22ba8137340eace28b14deedc7da69b (patch)
tree3d668f05ba3bca92da259218dd2da6c149c3338e
parentUpdate DOCKER_COMPOSE command to `docker compose` (#15056) (diff)
downloadawx-3edaaebba22ba8137340eace28b14deedc7da69b.tar.xz
awx-3edaaebba22ba8137340eace28b14deedc7da69b.zip
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>
-rw-r--r--tools/ansible/roles/dockerfile/templates/Dockerfile.j23
-rwxr-xr-xtools/docker-compose/awx-manage15
2 files changed, 14 insertions, 4 deletions
diff --git a/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 b/tools/ansible/roles/dockerfile/templates/Dockerfile.j2
index f2538990c1..53e8cc9b9c 100644
--- a/tools/ansible/roles/dockerfile/templates/Dockerfile.j2
+++ b/tools/ansible/roles/dockerfile/templates/Dockerfile.j2
@@ -242,7 +242,8 @@ ADD tools/scripts/awx-python /usr/bin/awx-python
{% if (build_dev|bool) or (kube_dev|bool) %}
RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.11/site-packages/awx.egg-link
-ADD tools/docker-compose/awx-manage /usr/local/bin/awx-manage
+RUN echo /awx_devel > /var/lib/awx/venv/awx/lib/python3.11/site-packages/awx.pth
+RUN ln -sf /awx_devel/tools/docker-compose/awx-manage /usr/local/bin/awx-manage
RUN ln -sf /awx_devel/tools/scripts/awx-python /usr/bin/awx-python
RUN ln -sf /awx_devel/tools/scripts/rsyslog-4xx-recovery /usr/bin/rsyslog-4xx-recovery
{% endif %}
diff --git a/tools/docker-compose/awx-manage b/tools/docker-compose/awx-manage
index d29bfdc359..fac1adb5e0 100755
--- a/tools/docker-compose/awx-manage
+++ b/tools/docker-compose/awx-manage
@@ -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(