Bug 1256571 - Rename ConfigureSandbox.exec_file to include_file. r=chmanchester

This commit is contained in:
Mike Hommey 2016-04-13 08:42:17 +09:00
Родитель 6f3578276f
Коммит 9da99bc058
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -169,9 +169,9 @@ class ConfigureSandbox(dict):
handler.setFormatter(formatter)
logger.addHandler(handler)
def exec_file(self, path):
'''Execute one file within the sandbox. Users of this class probably
want to use `run` instead.'''
def include_file(self, path):
'''Include one file in the sandbox. Users of this class probably want
to use `run` instead.'''
if self._paths:
path = mozpath.join(mozpath.dirname(self._paths[-1]), path)
@ -199,7 +199,7 @@ class ConfigureSandbox(dict):
def run(self, path):
'''Executes the given file within the sandbox, and ensure the overall
consistency of the executed script.'''
self.exec_file(path)
self.include_file(path)
for option in self._options.itervalues():
# All options must be referenced by some @depends function
@ -434,7 +434,7 @@ class ConfigureSandbox(dict):
if what:
if not isinstance(what, types.StringTypes):
raise TypeError("Unexpected type: '%s'" % type(what).__name__)
self.exec_file(what)
self.include_file(what)
def template_impl(self, func):
'''Implementation of @template.

Просмотреть файл

@ -56,7 +56,7 @@ class TestChecksConfigure(unittest.TestCase):
out = StringIO()
sandbox = FindProgramSandbox({}, stdout=out, stderr=out)
base_dir = os.path.join(topsrcdir, 'build', 'moz.configure')
sandbox.exec_file(os.path.join(base_dir, 'checks.configure'))
sandbox.include_file(os.path.join(base_dir, 'checks.configure'))
exec(textwrap.dedent('''
@checking('for a thing')
@ -158,8 +158,8 @@ class TestChecksConfigure(unittest.TestCase):
out = StringIO()
sandbox = FindProgramSandbox(config, environ, [prog] + args, out, out)
base_dir = os.path.join(topsrcdir, 'build', 'moz.configure')
sandbox.exec_file(os.path.join(base_dir, 'util.configure'))
sandbox.exec_file(os.path.join(base_dir, 'checks.configure'))
sandbox.include_file(os.path.join(base_dir, 'util.configure'))
sandbox.include_file(os.path.join(base_dir, 'checks.configure'))
status = 0
try:

Просмотреть файл

@ -372,7 +372,7 @@ class TestConfigure(unittest.TestCase):
out = StringIO()
sandbox = ConfigureSandbox(config, {}, [], out, out)
sandbox.exec_file(mozpath.join(test_data_path, 'decorators.configure'))
sandbox.include_file(mozpath.join(test_data_path, 'decorators.configure'))
self.assertNotIn('FOO', sandbox)
self.assertNotIn('BAR', sandbox)