From 62056cc37d52bab68be20575b5d12e4a99659f22 Mon Sep 17 00:00:00 2001 From: Sérgio M. Basto Date: Nov 22 2019 14:54:01 +0000 Subject: Directly call util.update_config_from_file --- diff --git a/src/FedoraReview/mock.py b/src/FedoraReview/mock.py index 53e3dc9..7083214 100644 --- a/src/FedoraReview/mock.py +++ b/src/FedoraReview/mock.py @@ -25,6 +25,8 @@ import os import os.path import re import shlex +from sysconfig import get_paths +import mockbuild.util from glob import glob from subprocess import call, Popen, PIPE, STDOUT, CalledProcessError @@ -387,14 +389,14 @@ class _Mock(HelpersMixin): else os.path.join(mockdir, config) ) - config_opts = _setup_default_config_opts() - with open(path) as f: - content = f.read() - content = re.sub(r'include\((.*)\)', - r'exec(open(\g<1>).read(), {}, locals())', - content) - config = compile(content, path, 'exec') - exec(config) + # we need disable trace from mock.util to avoid a lot of spurious + # messages which are send to stdout + logging.getLogger("trace").propagate = 0 + config_opts = mockbuild.util.setup_default_config_opts(None, "unknown", + get_paths()['purelib']) + config_opts['config_paths'] = [] + config_opts['__jinja_expand'] = True + mockbuild.util.update_config_from_file(config_opts, path, None) self.mock_root = config_opts["root"] if Settings.uniqueext: self.mock_root += Settings.uniqueext