Commit 7137c468 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Python 3 changes

parent 8e55b9e2
from __future__ import print_function
from __future__ import division
import osc
import osc.conf
import osc.core
import osc.oscerr
from osc.util.helper import decode_it
from functools import partial
from xml.etree import ElementTree
......@@ -256,10 +257,10 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
def actual_compilers():
for compiler in (c for c in compilers if c in all_compilers + ["default_compiler", "intel", "gcc"]):
if compiler == "intel":
for intel_compiler in filter(lambda cc: cc.startswith("intel"), all_compilers):
for intel_compiler in [cc for cc in all_compilers if cc.startswith("intel")]:
yield intel_compiler
elif compiler == "gcc":
for gcc_compiler in filter(lambda cc: cc.startswith("gcc"), all_compilers):
for gcc_compiler in [cc for cc in all_compilers if cc.startswith("gcc")]:
yield gcc_compiler
elif compiler == "default_compiler":
for default_compiler in default_compilers:
......@@ -270,7 +271,7 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
def actual_mpis():
for mpi in (m for m in mpis if m in all_mpis + ["default_mpi", "impi"]):
if mpi == "impi":
for impi in filter(lambda cc: cc.startswith("impi"), mpis):
for impi in [mpi for mpi in mpis if mpi.startswith("impi")]:
yield impi
elif mpi == "default_mpi":
for default_mpi in default_mpis:
......@@ -363,7 +364,7 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
root = project_meta(api_url, project)
prjconf = osc.core.show_project_conf(api_url, project)
prjconf = list(map(decode_it, osc.core.show_project_conf(api_url, project)))
start_marker = "# Autogenerated by osc mpcdf_setup_repos, do not edit till end of section\n"
end_marker = "# End of autogenerated section\n"
......@@ -568,8 +569,8 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
raise osc.oscerr.WrongArgs('Cannot specify `redo_all` and package')
if to_projects is None:
to_projects = filter(lambda s: s.startswith("software:") and not (s == "software:dist" or s == "software:images"),
osc.core.meta_get_project_list(api_url))
to_projects = [p for p in osc.core.meta_get_project_list(api_url)
if p.startswith("software:") and not (p == "software:dist" or p == "software:images")]
for to_project in to_projects:
print("Syncing {0} with {1}".format(to_project, from_project))
......
......@@ -31,8 +31,8 @@ def do_mpcdf_remove(self, subcmd, opts, *args):
api_url = self.get_api_url()
projects = filter(lambda s: s.startswith("software:") and not (s == "software:dist" or s == "software:images"),
osc.core.meta_get_project_list(api_url))
projects = [p for p in osc.core.meta_get_project_list(api_url)
if p.startswith("software:") and not (p == "software:dist" or p == "software:images")]
for project in projects:
print("Removing from", project)
......
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