def _build_extension(self, builder_class, project_path, out_path, cmd_args, build_steps, ignore): key = builder_class.key info = ExtensionInfo() kango_path = sys.path[0] builder = builder_class(info, kango_path) project_src_path = os.path.join(project_path, 'src') framework_src_path = os.path.join(kango_path, 'src', 'js') certificates_path = os.path.abspath(os.path.join(project_path, 'certificates')) builder.migrate((os.path.join(project_src_path, key))) logger.info('Building %s extension...' % key) extension_out_path = os.path.join(out_path, key) shutil.rmtree(extension_out_path, True) # merge framework and project sources self._copy_extension_files(info, framework_src_path, extension_out_path, key, ignore) self._copy_extension_files(info, project_src_path, extension_out_path, key, ignore) # copy files from additional source path additional_source_path = cmd_args.additional_source_path if additional_source_path is not None: paths = additional_source_path.split(';') for path in paths: self._copy_extension_files(info, path, extension_out_path, key, ignore) # add locales locales = list(self._get_locales(extension_out_path)) if len(locales) > 0: info.locales = locales if info.default_locale == '': die('"locales" directory exists, but "default_locale" is not set') elif info.default_locale not in locales: die('Locale "%s" doesn\'t exist' % info.default_locale) builder.setup_update(out_path) extension_out_path = builder.build(extension_out_path, os.path.join(project_src_path, key), certificates_path, cmd_args) if extension_out_path: info.framework_version = '%s %s' % (settings.VERSION, settings.BUILD) info.framework_package_id = settings.PACKAGE_ID info.save(os.path.join(extension_out_path, self.EXTENSION_INFO_NAME)) if not builder.has_native_require: self._wrap_js_modules(info, extension_out_path) # execute build steps for step in build_steps: step.pre_pack(extension_out_path, project_path, info, cmd_args) if not cmd_args.no_pack: builder.pack(out_path, os.path.abspath(extension_out_path), os.path.join(project_src_path, key), certificates_path, cmd_args) else: die("Can't build %s extension" % key)