mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Start handling static(and platform specific) requirements files
This commit is contained in:
parent
fd6068e70a
commit
0d96e640f2
2 changed files with 47 additions and 32 deletions
65
noxfile.py
65
noxfile.py
|
@ -10,6 +10,7 @@ Nox configuration script
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import pprint
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.stderr.write('Do not execute this file directly. Use nox instead, it will know how to handle this file\n')
|
||||
|
@ -51,42 +52,42 @@ def _create_ci_directories():
|
|||
os.makedirs(path)
|
||||
|
||||
|
||||
def _install_requirements_overrides(session, *extra_requirements):
|
||||
def _install_requirements(session, *extra_requirements):
|
||||
session.install('distro')
|
||||
output = session.run('distro', '-j', silent=True)
|
||||
distro_data = json.loads(output.strip())
|
||||
|
||||
requirements_overrides = REQUIREMENTS_OVERRIDES[None]
|
||||
requirements_overrides.extend(
|
||||
REQUIREMENTS_OVERRIDES.get(
|
||||
'{id}-{version}'.format(**distro_data),
|
||||
[]
|
||||
)
|
||||
)
|
||||
if requirements_overrides:
|
||||
for requirement in requirements_overrides:
|
||||
session.install(requirement)
|
||||
|
||||
|
||||
def _install_requirements(session, *extra_requirements):
|
||||
_install_requirements_overrides(session)
|
||||
# Install requirements
|
||||
_requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'pytest.txt')
|
||||
distro = json.loads(output.strip())
|
||||
session.log('Distro information:\n%s', pprint.pformat(distro))
|
||||
distro_keys = [
|
||||
'{id}-{version}'.format(**distro),
|
||||
'{id}-{version_parts[major]}'.format(**distro)
|
||||
]
|
||||
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'),
|
||||
|
||||
# Install requirements
|
||||
distro_requirements = None
|
||||
for distro_key in distro_keys:
|
||||
distro_requirements = os.path.join(REPO_ROOT, 'requirements', 'static', '{}.txt'.format(distro_key))
|
||||
if os.path.exists(distro_requirements):
|
||||
break
|
||||
if distro_requirements is not None:
|
||||
_requirements_files = [distro_requirements]
|
||||
requirements_files = []
|
||||
else:
|
||||
_requirements_files = [
|
||||
os.path.join(REPO_ROOT, 'requirements', 'pytest.txt')
|
||||
]
|
||||
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:
|
||||
|
|
14
requirements/static/README.rst
Normal file
14
requirements/static/README.rst
Normal file
|
@ -0,0 +1,14 @@
|
|||
What Is This All About
|
||||
======================
|
||||
|
||||
This directory will contain platform specific requirements(and the requirements
|
||||
of each requirements) locked to the versions used as if the testing environment
|
||||
was setup using the salt-jenkins states.
|
||||
|
||||
The purpose of this is to ease the transition to `nox` and golden images where
|
||||
only binary system packages are installed on the golden image and `nox`
|
||||
installs the python dependencies on virtualenv specifically created for the
|
||||
test run.
|
||||
|
||||
This will also make sure we run the tests with the exact same dependencies
|
||||
everytime.
|
Loading…
Add table
Reference in a new issue