Beispiel #1
0
    def _check_and_fill_electron(self, pkg: WebApplication, env: dict,
                                 local_config: dict, x86_x64: bool,
                                 output: List[EnvironmentComponent]):
        electron_version = env['electron']['version']

        if pkg.version and pkg.version != electron_version:
            self.logger.info(
                'A preset Electron version is defined for {}: {}'.format(
                    pkg.url, pkg.version))
            electron_version = pkg.version

        if local_config['environment']['electron']['version']:
            self.logger.warning(
                "A custom Electron version will be used {} to install {}".
                format(electron_version, pkg.url))
            electron_version = local_config['environment']['electron'][
                'version']

        electron_status = self.check_electron_installed(
            version=electron_version, is_x86_x64_arch=x86_x64)

        electron_url = self._get_electron_url(version=electron_version,
                                              is_x86_x64_arch=x86_x64)
        output.append(
            EnvironmentComponent(
                name=electron_url.split('/')[-1],
                version=electron_version,
                url=electron_url,
                size=self.http_client.get_content_length(electron_url),
                id='electron',
                update=not electron_status['electron']))

        sha_url = ELECTRON_SHA256_URL.format(version=electron_version)
        output.append(
            EnvironmentComponent(
                name=sha_url.split('/')[-1],
                version=electron_version,
                url=sha_url,
                size=self.http_client.get_content_length(sha_url),
                id='electron_sha256',
                update=not electron_status['electron']
                or not electron_status['sha256']))
Beispiel #2
0
 def _get_electron_sha256_url(self, version: str, widevine: bool) -> str:
     if widevine:
         return ELECTRON_WIDEVINE_SHA256_URL.format(version=version)
     else:
         return ELECTRON_SHA256_URL.format(version=version)