def _install_python_script(self, filename): '''Load the Python script into an environment.''' _logger.info(__(_('Using Python hook script {filename}.'), filename=filename)) hook_environment = HookEnvironment(self._factory) hook_environment.connect_hooks() with open(filename, 'rb') as in_file: code = compile(in_file.read(), filename, 'exec') context = {'wpull_hook': hook_environment} exec(code, context, context)
def _install_lua_script(self, filename): '''Load the Lua script into an environment.''' _logger.info(__(_('Using Lua hook script {filename}.'), filename=filename)) lua = wpull.hook.load_lua() hook_environment = HookEnvironment(self._factory, is_lua=True) hook_environment.connect_hooks() lua_globals = lua.globals() lua_globals.wpull_hook = hook_environment with open(filename, 'rb') as in_file: lua.execute(in_file.read())
def _install_python_script(self, filename): '''Load the Python script into an environment.''' _logger.info( _('Using Python hook script {filename}.').format( filename=filename)) hook_environment = HookEnvironment() self._setup_hook_environment(hook_environment) with open(filename, 'rb') as in_file: code = compile(in_file.read(), filename, 'exec') context = {'wpull_hook': hook_environment} exec(code, context, context)
def _install_lua_script(self, filename): '''Load the Lua script into an environment.''' _logger.info( _('Using Lua hook script {filename}.').format(filename=filename)) lua = wpull.hook.load_lua() hook_environment = HookEnvironment(is_lua=True) self._setup_hook_environment(hook_environment) lua_globals = lua.globals() lua_globals.wpull_hook = hook_environment with open(filename, 'rb') as in_file: lua.execute(in_file.read())