def _install_update(self, bundle_update, local_file_path): self._state = STATE_UPDATING total = self._total_bundles_to_update current = total - len(self._bundles_to_update) - 0.5 progress = current / float(total) _logger.debug("Installing update for %s", bundle_update.bundle_id) self.emit('progress', self._state, bundle_update.name, progress) current += 0.5 bundle = bundle_from_archive(local_file_path) registry = bundleregistry.get_registry() registry.install_async(bundle, self._bundle_installed_cb, current)
def test_install_activity(self): registry = bundleregistry.get_registry() bundle = bundle_from_archive(os.path.join(data_dir, 'activity-1.xo')) registry.install(bundle) installed_bundle = registry.get_bundle("org.sugarlabs.MyActivity") self.assertIsNotNone(installed_bundle)
def test_install_content(self): registry = bundleregistry.get_registry() bundle = bundle_from_archive(os.path.join(data_dir, 'sample-1.xol')) registry.install(bundle) installed_bundle = registry.get_bundle("org.sugarlabs.samplecontent") self.assertIsNotNone(installed_bundle)
def test_content_bundle_from_archive(self): os.chdir(data_dir) subprocess.check_call(["zip", "-r", "sample-1.xol", "sample.content"]) bundle = bundle_from_archive("./sample-1.xol") self.assertIsInstance(bundle, ContentBundle)
def test_activity_bundle_from_archive(self): os.chdir(SAMPLE_ACTIVITY_PATH) subprocess.check_call(["./setup.py", "dist_xo"]) xo_path = os.path.join(".", "dist", "Sample-1.xo") bundle = bundle_from_archive(xo_path) self.assertIsInstance(bundle, ActivityBundle)