Use exec() rather than execfile()

execfile() is not in Python 3.

Change-Id: I5af222340f13c1e8edaa820e7675d3e4d62a1689
This commit is contained in:
Anthony King 2014-05-05 21:15:34 +01:00
parent 666d534636
commit 70f6890352

View File

@ -438,7 +438,8 @@ class RepoHook(object):
# and convert to a HookError w/ just the failing traceback. # and convert to a HookError w/ just the failing traceback.
context = {} context = {}
try: try:
execfile(self._script_fullpath, context) exec(compile(open(self._script_fullpath).read(),
self._script_fullpath, 'exec'), context)
except Exception: except Exception:
raise HookError('%s\nFailed to import %s hook; see traceback above.' % ( raise HookError('%s\nFailed to import %s hook; see traceback above.' % (
traceback.format_exc(), self._hook_type)) traceback.format_exc(), self._hook_type))