mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 13:39:27 -02:30
Working out some python3 kinks
This commit is contained in:
14
Makefile
14
Makefile
@@ -134,8 +134,8 @@ virtualenv_ansible_py3:
|
|||||||
if [ ! -d "$(VENV_BASE)" ]; then \
|
if [ ! -d "$(VENV_BASE)" ]; then \
|
||||||
mkdir $(VENV_BASE); \
|
mkdir $(VENV_BASE); \
|
||||||
fi; \
|
fi; \
|
||||||
if [ ! -d "$(VENV_BASE)/ansible3" ]; then \
|
if [ ! -d "$(VENV_BASE)/ansible" ]; then \
|
||||||
python3 -m venv --system-site-packages $(VENV_BASE)/ansible3; \
|
$(PYTHON) -m venv --system-site-packages $(VENV_BASE)/ansible; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ virtualenv_awx:
|
|||||||
mkdir $(VENV_BASE); \
|
mkdir $(VENV_BASE); \
|
||||||
fi; \
|
fi; \
|
||||||
if [ ! -d "$(VENV_BASE)/awx" ]; then \
|
if [ ! -d "$(VENV_BASE)/awx" ]; then \
|
||||||
$(PYTHON) -m venv $(VENV_BASE)/awx; \
|
$(PYTHON) -m venv --system-site-packages $(VENV_BASE)/awx; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -158,9 +158,9 @@ requirements_ansible: virtualenv_ansible
|
|||||||
$(VENV_BASE)/ansible/bin/pip uninstall --yes -r requirements/requirements_ansible_uninstall.txt
|
$(VENV_BASE)/ansible/bin/pip uninstall --yes -r requirements/requirements_ansible_uninstall.txt
|
||||||
|
|
||||||
requirements_ansible_py3: virtualenv_ansible_py3
|
requirements_ansible_py3: virtualenv_ansible_py3
|
||||||
cat requirements/requirements_ansible.txt requirements/requirements_ansible_git.txt | $(VENV_BASE)/ansible3/bin/pip3 install $(PIP_OPTIONS) --no-binary $(SRC_ONLY_PKGS) --ignore-installed -r /dev/stdin
|
cat requirements/requirements_ansible.txt requirements/requirements_ansible_git.txt | $(VENV_BASE)/ansible/bin/pip3 install $(PIP_OPTIONS) --no-binary $(SRC_ONLY_PKGS) --ignore-installed -r /dev/stdin
|
||||||
$(VENV_BASE)/ansible3/bin/pip3 install ansible # can't inherit from system ansible, it's py2
|
$(VENV_BASE)/ansible/bin/pip3 install ansible # can't inherit from system ansible, it's py2
|
||||||
$(VENV_BASE)/ansible3/bin/pip3 uninstall --yes -r requirements/requirements_ansible_uninstall.txt
|
$(VENV_BASE)/ansible/bin/pip3 uninstall --yes -r requirements/requirements_ansible_uninstall.txt
|
||||||
|
|
||||||
requirements_ansible_dev:
|
requirements_ansible_dev:
|
||||||
if [ "$(VENV_BASE)" ]; then \
|
if [ "$(VENV_BASE)" ]; then \
|
||||||
@@ -189,7 +189,7 @@ requirements_awx_dev:
|
|||||||
|
|
||||||
requirements: requirements_ansible requirements_awx
|
requirements: requirements_ansible requirements_awx
|
||||||
|
|
||||||
requirements_dev: requirements requirements_ansible_py3 requirements_awx_dev requirements_ansible_dev
|
requirements_dev: requirements requirements_awx_dev requirements_ansible_dev
|
||||||
|
|
||||||
requirements_test: requirements
|
requirements_test: requirements
|
||||||
|
|
||||||
|
|||||||
@@ -173,14 +173,12 @@ def test_extract_ansible_vars():
|
|||||||
|
|
||||||
def test_get_custom_venv_choices():
|
def test_get_custom_venv_choices():
|
||||||
bundled_venv = os.path.join(settings.BASE_VENV_PATH, 'ansible', '')
|
bundled_venv = os.path.join(settings.BASE_VENV_PATH, 'ansible', '')
|
||||||
bundled_venv_py3 = os.path.join(settings.BASE_VENV_PATH, 'ansible3', '')
|
assert sorted(common.get_custom_venv_choices()) == [bundled_venv]
|
||||||
assert sorted(common.get_custom_venv_choices()) == [bundled_venv, bundled_venv_py3]
|
|
||||||
|
|
||||||
with TemporaryDirectory(dir=settings.BASE_VENV_PATH, prefix='tmp') as temp_dir:
|
with TemporaryDirectory(dir=settings.BASE_VENV_PATH, prefix='tmp') as temp_dir:
|
||||||
os.makedirs(os.path.join(temp_dir, 'bin', 'activate'))
|
os.makedirs(os.path.join(temp_dir, 'bin', 'activate'))
|
||||||
assert sorted(common.get_custom_venv_choices()) == [
|
assert sorted(common.get_custom_venv_choices()) == [
|
||||||
bundled_venv,
|
bundled_venv,
|
||||||
bundled_venv_py3,
|
|
||||||
os.path.join(temp_dir, '')
|
os.path.join(temp_dir, '')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ if [ -f /var/lib/awx/venv/awx/bin/activate ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the requested Python command, using the interpreter from the path
|
# Run the requested Python command, using the interpreter from the path
|
||||||
exec python "$@"
|
exec python3 "$@"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
|||||||
Reference in New Issue
Block a user