Commit 421ed4fc authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Support for default_python[23] attributes

parent 7137c468
......@@ -11,7 +11,7 @@ from xml.etree import ElementTree
package_attributes = ["MPCDF:enable_repositories"]
config_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules", "MPCDF:pgi_modules"]
default_attributes = ["MPCDF:default_compiler", "MPCDF:default_cuda", "MPCDF:default_mpi"]
default_attributes = ["MPCDF:default_compiler", "MPCDF:default_cuda", "MPCDF:default_mpi", "MPCDF:default_python2", "MPCDF:default_python3"]
intel_parallel_studio = {
"mpcdf_intel_parallel_studio_2017_7": {"compiler": "intel_17_0_7", "impi": "impi_2017_4", "mkl": "mkl_2017_4-module", },
......@@ -139,6 +139,11 @@ def get_attribute_values(api_url, project, package, attribute, with_project=Fals
return list(value.text for value in attribute.findall("./value"))
def get_attribute_value(api_url, project, package, attribute, with_project=False):
value, = get_attribute_values(api_url, project, package, attribute, with_project=False)
return value
def set_attribute(api_url, project, package, attribute):
path = ["source", project]
if package:
......@@ -341,10 +346,12 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
print("Copying attribute '{0}' from parent project".format(attribute))
set_attribute(api_url, project, None, get_attribute(api_url, parent, None, attribute))
compilers = list(get_attribute_values(api_url, project, None, "MPCDF:compiler_modules"))
mpis = list(get_attribute_values(api_url, project, None, "MPCDF:mpi_modules"))
cudas = list(get_attribute_values(api_url, project, None, "MPCDF:cuda_modules"))
pgis = list(get_attribute_values(api_url, project, None, "MPCDF:pgi_modules"))
compilers = get_attribute_values(api_url, project, None, "MPCDF:compiler_modules")
mpis = get_attribute_values(api_url, project, None, "MPCDF:mpi_modules")
cudas = get_attribute_values(api_url, project, None, "MPCDF:cuda_modules")
pgis = get_attribute_values(api_url, project, None, "MPCDF:pgi_modules")
default_python2 = get_attribute_value(api_url, project, None, "MPCDF:default_python2")
default_python3 = get_attribute_value(api_url, project, None, "MPCDF:default_python3")
if distribution is None:
# Get existing value from project meta
......@@ -379,6 +386,10 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
prjconf_tail = "".join(prjconf[end + 1:])
prjconf = [start_marker]
prjconf.append("Prefer: mpcdf_python2_" + default_python2)
prjconf.append("Prefer: mpcdf_python3_" + default_python3)
prjconf.append("")
# Remove existing repositories
if remove_old:
for oldrepo in root.findall("./repository"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment