Allow package-installs to parse DIB_PYTHON_VERSION

Now that we are explicit about what python version we intend to use
for dib we can have package installs optionally install packages
depending on this.  Add a new dib_python_version that matches on the
DIB_PYTHON_VERSION string set by dib-python.

Co-Authored-By: Adam Harwell <flux.adam@gmail.com>
Change-Id: I70659aab7d12924bdb9bc0489a7f02d5fd0dbb39
This commit is contained in:
Gregory Haynes 2016-12-07 12:34:11 -08:00 committed by Ian Wienand
parent 6278371eaa
commit ecae8dcbd5
2 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,10 @@ example ``package-installs.yaml``
not-arch: ppc64, ppc64le
lshw:
arch: ppc64, ppc64le
python-dev:
dib_python_version: 2
python3-dev:
dib_python_version: 3
example package-installs.json
@ -46,6 +50,7 @@ the following default values::
uninstall: False
installtype: * (Install package for all installtypes)
arch: * (Install package for all architectures)
dib_python_version: (2 or 3 depending on DIB_PYTHON_VERSION, see dib-python)
Setting the installtype property causes the package only to be installed if
the specified installtype would be used for the element. See the

View File

@ -75,8 +75,12 @@ def collect_data(data, filename, element_name):
installtype == elem_installtype)
valid_arch = _valid_for_arch(pkg_name, params.get('arch', None),
params.get('not-arch', None))
dib_py_version = str(params.get('dib_python_version', ''))
dib_py_version_env = os.environ.get('DIB_PYTHON_VERSION', '')
valid_dib_python_version = (dib_py_version == '' or
dib_py_version == dib_py_version_env)
if valid_installtype and valid_arch:
if valid_installtype and valid_arch and valid_dib_python_version:
data[phase][install].append((pkg_name, element_name))
return data