def _copy_icon(self, out_path):
		src = os.path.join(out_path, 'icons', 'icon100.png')
		dst = os.path.join(out_path, 'icon.png')
		try:
			shutil.copy(src, dst)
		except:
			kango.log('Can\'t find icon100.png')
Exemple #2
0
	def pack(self, dst, src, src_path):
		chrome_path = self.get_chrome_path()
		if chrome_path is not None:
			extension_path = os.path.abspath(src)
			certificate_path = os.path.abspath(os.path.join(extension_path, '../', '../', 'certificates'))
			if not os.path.exists(certificate_path):
				os.makedirs(certificate_path)
			certificate_path = os.path.join(certificate_path, 'chrome.pem')

			cmd = chrome_path + ' --pack-extension="' + extension_path + '"'
			if os.path.isfile(certificate_path):
				cmd += ' --pack-extension-key="' + certificate_path + '"'
			cmd += ' --no-message-box'
			os.system(cmd.encode(sys.getfilesystemencoding()))

			extension_dst = os.path.abspath(os.path.join(extension_path, '../', 'chrome.crx'))
			if not os.path.isfile(extension_dst):
				cmd = '"' + chrome_path + '"' + ' --pack-extension="' + extension_path + '"'
				if os.path.isfile(certificate_path):
					cmd += ' --pack-extension-key="' + certificate_path + '"'
				cmd += ' --no-message-box'
				subprocess.call(cmd.encode(sys.getfilesystemencoding()))
			try:
				shutil.move(os.path.abspath(os.path.join(extension_path, '../', 'chrome.pem')), certificate_path)
			except:
				pass
			shutil.move(extension_dst, os.path.join(dst, self.get_full_package_name(self._info)))
		else:
			kango.log('Chrome/Chromium is not installed, can\'t pack chrome extension.')
Exemple #3
0
	def execute(self, args):
		project_dir = args.project_directory
		if os.path.isdir(project_dir):
			# load build steps from project directory
			self._load_build_steps(os.path.join(project_dir, 'buildsteps'))
			builder = ProjectBuilder()
			builder.build(project_dir, args, self._build_steps)
		else:
			kango.log('Can\'t find directory ' + project_dir)
	def execute(self, args):
		project_dir = args.project_directory
		if os.path.isdir(project_dir):
			# load build steps from project directory
			self._load_build_steps(os.path.join(project_dir, 'buildsteps'))
			builder = ProjectBuilder()
			builder.build(project_dir, args, self._build_steps)
		else:
			kango.log('Can\'t find directory ' + project_dir)
	def _build_extension(self, builder_class, project_dir, out_path, args, build_steps):
		key = builder_class.key
		info = kango.ExtensionInfo()
		kango_path = sys.path[0]
		builder = builder_class(info, kango_path)

		project_src_path = os.path.join(project_dir, 'src')
		framework_src_path = os.path.join(kango_path, 'src', 'js')

		builder.migrate((os.path.join(project_src_path, key)))

		# merge extension_info
		info.load(os.path.join(project_src_path, 'common', self._extension_info_name))
		info.load(os.path.join(project_src_path, key, self._extension_info_name))

		kango.log('Building ' + builder.key + ' extension')

		extension_out_path = os.path.join(out_path, builder.key)

		# merge framework and project sources
		self._copy_extension_files(framework_src_path, extension_out_path, builder.key)
		self._copy_extension_files(project_src_path, extension_out_path, builder.key)

		builder.setup_update(out_path)

		extension_out_path = builder.build(extension_out_path)

		# add locales
		locales = self._get_locales(extension_out_path)
		if len(locales) > 0:
			info.locales = locales

		info.kango_version = '%s %s' % (kango.VERSION, kango.BUILD)

		info.save(os.path.join(extension_out_path, self._extension_info_name))

		# execute build steps
		for step in build_steps:
			step.pre_build(extension_out_path, project_dir, info, args)

		builder.pack(out_path, extension_out_path, os.path.join(project_src_path, key))
Exemple #6
0
	def pack(self, dst, src, src_path):
		chrome_path = self.get_chrome_path()
		if chrome_path is not None:
			extension_path = os.path.abspath(src)
			certificate_path = os.path.abspath(os.path.join(extension_path, '../', '../', 'certificates'))
			if not os.path.exists(certificate_path):
				os.makedirs(certificate_path)
			certificate_path = os.path.join(certificate_path, 'chrome.pem')
			extension_dst = os.path.abspath(os.path.join(extension_path, '../', 'chrome.crx'))

			cmd = chrome_path + ' --pack-extension="' + extension_path + '"'
			if os.path.isfile(certificate_path):
				cmd += ' --pack-extension-key="' + certificate_path + '"'
			cmd += ' --no-message-box'
			os.system(cmd.encode(sys.getfilesystemencoding()))

			if not os.path.isfile(extension_dst):
				cmd = '\"\"' + chrome_path + '"' + ' --pack-extension="' + extension_path + '"'
				if os.path.isfile(certificate_path):
					cmd += ' --pack-extension-key="' + certificate_path + '"'
				cmd += ' --no-message-box "'
				os.system(cmd.encode(sys.getfilesystemencoding()))
			
			if not os.path.isfile(extension_dst):
				cmd = '"' + chrome_path + '"' + ' --pack-extension="' + extension_path + '"'
				if os.path.isfile(certificate_path):
					cmd += ' --pack-extension-key="' + certificate_path + '"'
				cmd += ' --no-message-box'
				subprocess.call(cmd.encode(sys.getfilesystemencoding()))
			
			try:
				shutil.move(os.path.abspath(os.path.join(extension_path, '../', 'chrome.pem')), certificate_path)
			except:
				pass
			shutil.move(extension_dst, os.path.join(dst, self.get_full_package_name(self._info)))
		else:
			kango.log('Chrome/Chromium is not installed, can\'t pack chrome extension.')
Exemple #7
0
	def pre_build(self, output_path, project_path, info, args):
			if args.minimize:
				if ClosureCompilerHelper().is_installed():
					self._process_dir(output_path)
				else:
					kango.log('compiler.jar not found')
Exemple #8
0
 def pre_build(self, output_path, project_path, info, args):
     if args.minimize:
         if ClosureCompilerHelper().is_installed():
             self._process_dir(output_path)
         else:
             kango.log("compiler.jar not found")