mirror of
https://github.com/ansible/awx.git
synced 2026-05-05 16:37:37 -02:30
towards virtualenv being exactly requirements.txt
* Ignore already installed (usually global) packages when installing requirements.txt into the virtualenv.
This commit is contained in:
8
Makefile
8
Makefile
@@ -284,18 +284,18 @@ virtualenv_tower:
|
|||||||
requirements_ansible: virtualenv_ansible
|
requirements_ansible: virtualenv_ansible
|
||||||
if [ "$(VENV_BASE)" ]; then \
|
if [ "$(VENV_BASE)" ]; then \
|
||||||
. $(VENV_BASE)/ansible/bin/activate; \
|
. $(VENV_BASE)/ansible/bin/activate; \
|
||||||
$(VENV_BASE)/ansible/bin/pip install --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements_ansible.txt ;\
|
$(VENV_BASE)/ansible/bin/pip install --ignore-installed --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements_ansible.txt ;\
|
||||||
else \
|
else \
|
||||||
pip install --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements_ansible.txt ; \
|
pip install --ignore-installed --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements_ansible.txt ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install third-party requirements needed for Tower's environment.
|
# Install third-party requirements needed for Tower's environment.
|
||||||
requirements_tower: virtualenv_tower
|
requirements_tower: virtualenv_tower
|
||||||
if [ "$(VENV_BASE)" ]; then \
|
if [ "$(VENV_BASE)" ]; then \
|
||||||
. $(VENV_BASE)/tower/bin/activate; \
|
. $(VENV_BASE)/tower/bin/activate; \
|
||||||
$(VENV_BASE)/tower/bin/pip install --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements.txt ;\
|
$(VENV_BASE)/tower/bin/pip install --ignore-installed --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements.txt ;\
|
||||||
else \
|
else \
|
||||||
pip install --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements.txt ; \
|
pip install --ignore-installed --no-binary $(SRC_ONLY_PKGS) -r requirements/requirements.txt ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
requirements_tower_dev:
|
requirements_tower_dev:
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
|
|
||||||
|
import os
|
||||||
from pip.operations import freeze
|
from pip.operations import freeze
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
def test_req():
|
def test_env_matches_requirements_txt():
|
||||||
|
|
||||||
def check_is_in(src, dests):
|
def check_is_in(src, dests):
|
||||||
if src not in dests:
|
if src not in dests:
|
||||||
src2 = [src[0].replace('_', '-'), src[1]]
|
print("%s not in" % src)
|
||||||
if src2 not in dests:
|
return False
|
||||||
print("%s not in" % src2)
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
print("%s not in" % src)
|
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
base_dir = settings.BASE_DIR
|
base_dir = settings.BASE_DIR
|
||||||
|
requirements_path = os.path.join(base_dir, '../', 'requirements/requirements.txt')
|
||||||
|
|
||||||
reqs_actual = []
|
reqs_actual = []
|
||||||
xs = freeze.freeze(local_only=True, requirement=base_dir + "/../requirements/requirements.txt")
|
xs = freeze.freeze(local_only=True, requirement=requirements_path)
|
||||||
for x in xs:
|
for x in xs:
|
||||||
if '## The following requirements were added by pip freeze' in x:
|
if '## The following requirements were added by pip freeze' in x:
|
||||||
break
|
break
|
||||||
reqs_actual.append(x.split('=='))
|
reqs_actual.append(x.split('=='))
|
||||||
|
|
||||||
reqs_expected = []
|
reqs_expected = []
|
||||||
with open(base_dir + "/../requirements/requirements.txt") as f:
|
with open(requirements_path) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line.rstrip()
|
line.rstrip()
|
||||||
# TODO: process git requiremenst and use egg
|
# TODO: process git requiremenst and use egg
|
||||||
@@ -34,15 +34,12 @@ def test_req():
|
|||||||
line.rstrip()
|
line.rstrip()
|
||||||
reqs_expected.append(line.rstrip().split('=='))
|
reqs_expected.append(line.rstrip().split('=='))
|
||||||
|
|
||||||
for r in reqs_actual:
|
|
||||||
print(r)
|
|
||||||
|
|
||||||
not_found = []
|
not_found = []
|
||||||
for r in reqs_expected:
|
for r in reqs_expected:
|
||||||
res = check_is_in(r, reqs_actual)
|
res = check_is_in(r, reqs_actual)
|
||||||
if res is False:
|
if res is False:
|
||||||
not_found.append(r)
|
not_found.append(r)
|
||||||
|
|
||||||
raise RuntimeError("%s not found in \n\n%s" % (not_found, reqs_expected))
|
raise RuntimeError("%s not found in \n\n%s" % (not_found, reqs_actual))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ suds==0.4
|
|||||||
unicodecsv==0.14.1
|
unicodecsv==0.14.1
|
||||||
warlock==1.2.0
|
warlock==1.2.0
|
||||||
twilio==4.9.1
|
twilio==4.9.1
|
||||||
uwsgi==2.0.14
|
uWSGI==2.0.14
|
||||||
wheel==0.24.0
|
wheel==0.24.0
|
||||||
wrapt==1.10.6
|
wrapt==1.10.6
|
||||||
wsgiref==0.1.2
|
wsgiref==0.1.2
|
||||||
|
|||||||
Reference in New Issue
Block a user