|
|
@ -216,11 +216,12 @@ def get_cryptography_requirement(args, python_version): # type: (EnvironmentCon
|
|
|
|
return cryptography
|
|
|
|
return cryptography
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_command_requirements(args, python_version=None, context=None):
|
|
|
|
def install_command_requirements(args, python_version=None, context=None, enable_pyyaml_check=False):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
:type args: EnvironmentConfig
|
|
|
|
:type args: EnvironmentConfig
|
|
|
|
:type python_version: str | None
|
|
|
|
:type python_version: str | None
|
|
|
|
:type context: str | None
|
|
|
|
:type context: str | None
|
|
|
|
|
|
|
|
:type enable_pyyaml_check: bool
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
if not args.explain:
|
|
|
|
if not args.explain:
|
|
|
|
make_dirs(ResultType.COVERAGE.path)
|
|
|
|
make_dirs(ResultType.COVERAGE.path)
|
|
|
@ -251,11 +252,24 @@ def install_command_requirements(args, python_version=None, context=None):
|
|
|
|
|
|
|
|
|
|
|
|
pip = generate_pip_command(find_python(python_version))
|
|
|
|
pip = generate_pip_command(find_python(python_version))
|
|
|
|
|
|
|
|
|
|
|
|
# make sure basic ansible-test requirements are met, including making sure that pip is recent enough to support constraints
|
|
|
|
# skip packages which have aleady been installed for python_version
|
|
|
|
# virtualenvs created by older distributions may include very old pip versions, such as those created in the centos6 test container (pip 6.0.8)
|
|
|
|
|
|
|
|
run_command(args, generate_pip_install(pip, 'ansible-test', use_constraints=False))
|
|
|
|
try:
|
|
|
|
|
|
|
|
package_cache = install_command_requirements.package_cache
|
|
|
|
|
|
|
|
except AttributeError:
|
|
|
|
|
|
|
|
package_cache = install_command_requirements.package_cache = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
installed_packages = package_cache.setdefault(python_version, set())
|
|
|
|
|
|
|
|
skip_packages = [package for package in packages if package in installed_packages]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for package in skip_packages:
|
|
|
|
|
|
|
|
packages.remove(package)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
installed_packages.update(packages)
|
|
|
|
|
|
|
|
|
|
|
|
if args.command != 'sanity':
|
|
|
|
if args.command != 'sanity':
|
|
|
|
|
|
|
|
install_ansible_test_requirements(args, pip)
|
|
|
|
|
|
|
|
|
|
|
|
# make sure setuptools is available before trying to install cryptography
|
|
|
|
# make sure setuptools is available before trying to install cryptography
|
|
|
|
# the installed version of setuptools affects the version of cryptography to install
|
|
|
|
# the installed version of setuptools affects the version of cryptography to install
|
|
|
|
run_command(args, generate_pip_install(pip, '', packages=['setuptools']))
|
|
|
|
run_command(args, generate_pip_install(pip, '', packages=['setuptools']))
|
|
|
@ -276,10 +290,14 @@ def install_command_requirements(args, python_version=None, context=None):
|
|
|
|
|
|
|
|
|
|
|
|
commands = [cmd for cmd in commands if cmd]
|
|
|
|
commands = [cmd for cmd in commands if cmd]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not commands:
|
|
|
|
|
|
|
|
return # no need to detect changes or run pip check since we are not making any changes
|
|
|
|
|
|
|
|
|
|
|
|
# only look for changes when more than one requirements file is needed
|
|
|
|
# only look for changes when more than one requirements file is needed
|
|
|
|
detect_pip_changes = len(commands) > 1
|
|
|
|
detect_pip_changes = len(commands) > 1
|
|
|
|
|
|
|
|
|
|
|
|
# first pass to install requirements, changes expected unless environment is already set up
|
|
|
|
# first pass to install requirements, changes expected unless environment is already set up
|
|
|
|
|
|
|
|
install_ansible_test_requirements(args, pip)
|
|
|
|
changes = run_pip_commands(args, pip, commands, detect_pip_changes)
|
|
|
|
changes = run_pip_commands(args, pip, commands, detect_pip_changes)
|
|
|
|
|
|
|
|
|
|
|
|
if changes:
|
|
|
|
if changes:
|
|
|
@ -300,6 +318,27 @@ def install_command_requirements(args, python_version=None, context=None):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if enable_pyyaml_check:
|
|
|
|
|
|
|
|
# pyyaml may have been one of the requirements that was installed, so perform an optional check for it
|
|
|
|
|
|
|
|
check_pyyaml(args, python_version, required=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_ansible_test_requirements(args, pip): # type: (EnvironmentConfig, t.List[str]) -> None
|
|
|
|
|
|
|
|
"""Install requirements for ansible-test for the given pip if not already installed."""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
installed = install_command_requirements.installed
|
|
|
|
|
|
|
|
except AttributeError:
|
|
|
|
|
|
|
|
installed = install_command_requirements.installed = set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tuple(pip) in installed:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# make sure basic ansible-test requirements are met, including making sure that pip is recent enough to support constraints
|
|
|
|
|
|
|
|
# virtualenvs created by older distributions may include very old pip versions, such as those created in the centos6 test container (pip 6.0.8)
|
|
|
|
|
|
|
|
run_command(args, generate_pip_install(pip, 'ansible-test', use_constraints=False))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
installed.add(tuple(pip))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_pip_commands(args, pip, commands, detect_pip_changes=False):
|
|
|
|
def run_pip_commands(args, pip, commands, detect_pip_changes=False):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|