diff --git a/bin/pungi-gather b/bin/pungi-gather index aa70977b..2546799c 100755 --- a/bin/pungi-gather +++ b/bin/pungi-gather @@ -3,8 +3,9 @@ from __future__ import print_function -import os import argparse +import os +import sys import pungi.ks from pungi.dnf_wrapper import DnfWrapper, Conf @@ -142,7 +143,7 @@ def main(persistdir, cachedir): else: print_rpms(g) if ns.profiler: - Profiler.print_results() + Profiler.print_results(stream=sys.stderr) def _get_flags(gather_obj, pkg): diff --git a/pungi/profiler.py b/pungi/profiler.py index 49bd719e..15f35476 100644 --- a/pungi/profiler.py +++ b/pungi/profiler.py @@ -40,6 +40,7 @@ from __future__ import print_function import functools +import sys import time @@ -66,9 +67,10 @@ class Profiler(object): return decorated @classmethod - def print_results(cls): - print("Profiling results:") + def print_results(cls, stream=sys.stdout): + print("Profiling results:", file=sys.stdout) results = cls._data.items() results = sorted(results, key=lambda x: x[1]["time"], reverse=True) for name, data in results: - print(" %6.2f %5d %s" % (data["time"], data["calls"], name)) + print(" %6.2f %5d %s" % (data["time"], data["calls"], name), + file=sys.stdout)