mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Switch to pip constraints files
This commit is contained in:
parent
503f1e2a82
commit
5df806955b
1 changed files with 92 additions and 40 deletions
132
noxfile.py
132
noxfile.py
|
@ -175,9 +175,9 @@ def _install_system_packages(session):
|
|||
shutil.copyfile(src, dst)
|
||||
|
||||
|
||||
def _install_requirements(session, transport, *extra_requirements):
|
||||
def _get_distro_pip_constraints(session, transport):
|
||||
# Install requirements
|
||||
distro_requirements = None
|
||||
distro_constraints = []
|
||||
|
||||
if transport == 'tcp':
|
||||
# The TCP requirements are the exact same requirements as the ZeroMQ ones
|
||||
|
@ -186,13 +186,20 @@ def _install_requirements(session, transport, *extra_requirements):
|
|||
pydir = _get_pydir(session)
|
||||
|
||||
if IS_WINDOWS:
|
||||
_distro_requirements = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'{}-windows.txt'.format(transport))
|
||||
if os.path.exists(_distro_requirements):
|
||||
distro_requirements = _distro_requirements
|
||||
_distro_constraints = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'{}-windows.txt'.format(transport))
|
||||
if os.path.exists(_distro_constraints):
|
||||
distro_constraints.append(_distro_constraints)
|
||||
_distro_constraints = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'windows.txt')
|
||||
if os.path.exists(_distro_constraints):
|
||||
distro_constraints.append(_distro_constraints)
|
||||
else:
|
||||
_install_system_packages(session)
|
||||
distro = _get_distro_info(session)
|
||||
|
@ -203,35 +210,47 @@ def _install_requirements(session, transport, *extra_requirements):
|
|||
'{id}-{version_parts[major]}'.format(**distro)
|
||||
]
|
||||
for distro_key in distro_keys:
|
||||
_distro_requirements = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'{}-{}.txt'.format(transport, distro_key))
|
||||
if os.path.exists(_distro_requirements):
|
||||
distro_requirements = _distro_requirements
|
||||
break
|
||||
_distro_constraints = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'{}.txt'.format(distro_key))
|
||||
if os.path.exists(_distro_constraints):
|
||||
distro_constraints.append(_distro_constraints)
|
||||
_distro_constraints = os.path.join(REPO_ROOT,
|
||||
'requirements',
|
||||
'static',
|
||||
pydir,
|
||||
'{}-{}.txt'.format(transport, distro_key))
|
||||
if os.path.exists(_distro_constraints):
|
||||
distro_constraints.append(_distro_constraints)
|
||||
return distro_constraints
|
||||
|
||||
if distro_requirements is not None:
|
||||
_requirements_files = [distro_requirements]
|
||||
requirements_files = []
|
||||
else:
|
||||
_requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'pytest.txt')
|
||||
|
||||
def _install_requirements(session, transport, *extra_requirements):
|
||||
# Install requirements
|
||||
distro_constraints = _get_distro_pip_constraints(session, transport)
|
||||
|
||||
_requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'base.txt'),
|
||||
os.path.join(REPO_ROOT, 'requirements', 'zeromq.txt'),
|
||||
os.path.join(REPO_ROOT, 'requirements', 'pytest.txt')
|
||||
]
|
||||
if sys.platform.startswith('linux'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'static', 'linux.in')
|
||||
]
|
||||
elif sys.platform.startswith('win'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'pkg', 'windows', 'req.txt'),
|
||||
os.path.join(REPO_ROOT, 'requirements', 'static', 'windows.in')
|
||||
]
|
||||
elif sys.platform.startswith('darwin'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'pkg', 'osx', 'req.txt'),
|
||||
os.path.join(REPO_ROOT, 'pkg', 'osx', 'req_ext.txt'),
|
||||
os.path.join(REPO_ROOT, 'requirements', 'static', 'osx.in')
|
||||
]
|
||||
if sys.platform.startswith('linux'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'tests.txt')
|
||||
]
|
||||
elif sys.platform.startswith('win'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'pkg', 'windows', 'req.txt'),
|
||||
]
|
||||
elif sys.platform.startswith('darwin'):
|
||||
requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'pkg', 'osx', 'req.txt'),
|
||||
os.path.join(REPO_ROOT, 'pkg', 'osx', 'req_ext.txt'),
|
||||
]
|
||||
|
||||
while True:
|
||||
if not requirements_files:
|
||||
|
@ -255,10 +274,25 @@ def _install_requirements(session, transport, *extra_requirements):
|
|||
continue
|
||||
|
||||
for requirements_file in _requirements_files:
|
||||
session.install('--progress-bar=off', '-r', requirements_file, silent=PIP_INSTALL_SILENT)
|
||||
install_command = [
|
||||
'--progress-bar=off', '-r', requirements_file
|
||||
]
|
||||
for distro_constraint in distro_constraints:
|
||||
install_command.extend([
|
||||
'--constraint', distro_constraint
|
||||
])
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
if extra_requirements:
|
||||
session.install('--progress-bar=off', *extra_requirements, silent=PIP_INSTALL_SILENT)
|
||||
install_command = [
|
||||
'--progress-bar=off',
|
||||
]
|
||||
for distro_constraint in distro_constraints:
|
||||
install_command.extend([
|
||||
'--constraint', distro_constraint
|
||||
])
|
||||
install_command += list(extra_requirements)
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
|
||||
def _run_with_coverage(session, *test_cmd):
|
||||
|
@ -372,7 +406,16 @@ def runtests_parametrized(session, coverage, transport, crypto):
|
|||
session.run('pip', 'uninstall', '-y', 'pycrypto', 'pycryptodome', 'pycryptodomex', silent=True)
|
||||
else:
|
||||
session.run('pip', 'uninstall', '-y', 'm2crypto', silent=True)
|
||||
session.install('--progress-bar=off', crypto, silent=PIP_INSTALL_SILENT)
|
||||
distro_constraints = _get_distro_pip_constraints(session, transport)
|
||||
install_command = [
|
||||
'--progress-bar=off',
|
||||
]
|
||||
for distro_constraint in distro_constraints:
|
||||
install_command.extend([
|
||||
'--constraint', distro_constraint
|
||||
])
|
||||
install_command.append(crypto)
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
cmd_args = [
|
||||
'--tests-logfile={}'.format(
|
||||
|
@ -558,7 +601,16 @@ def pytest_parametrized(session, coverage, transport, crypto):
|
|||
session.run('pip', 'uninstall', '-y', 'pycrypto', 'pycryptodome', 'pycryptodomex', silent=True)
|
||||
else:
|
||||
session.run('pip', 'uninstall', '-y', 'm2crypto', silent=True)
|
||||
session.install('--progress-bar=off', crypto, silent=PIP_INSTALL_SILENT)
|
||||
distro_constraints = _get_distro_pip_constraints(session, transport)
|
||||
install_command = [
|
||||
'--progress-bar=off',
|
||||
]
|
||||
for distro_constraint in distro_constraints:
|
||||
install_command.extend([
|
||||
'--constraint', distro_constraint
|
||||
])
|
||||
install_command.append(crypto)
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
cmd_args = [
|
||||
'--rootdir', REPO_ROOT,
|
||||
|
|
Loading…
Add table
Reference in a new issue