# Path: kiwixbuild/versions.py



import os
import tarfile
from urllib.request import urlopen
from urllib.error import URLError
from kiwixbuild.versions import base_deps_meta_version
from common import (
    print_message,
    run_kiwix_build,
    upload,
    make_deps_archive,
    HOME,
    PLATFORM_TARGET,
    OS_NAME,
)
#!/usr/bin/env python3




def download_base_archive(base_name):
    url = "http://tmp.kiwix.org/ci/{}".format(base_name)
    file_path = str(HOME / base_name)
    batch_size = 1024 * 1024 * 8
    with urlopen(url) as resource, open(file_path, "wb") as file:
        while True:
            batch = resource.read(batch_size)
            if not batch:
                break
            print(".", end="", flush=True)
            file.write(batch)
    return file_path

ARCHIVE_NAME_TEMPLATE = "base_deps2_{os}_{platform}_{version}.tar.xz"

if PLATFORM_TARGET == 'flatpak':
    base_dep_archive_name = "base_deps2_{}_flatpak.tar.xz".format(OS_NAME)
else:
    base_dep_archive_name = ARCHIVE_NAME_TEMPLATE.format(
        os=OS_NAME,
        platform=PLATFORM_TARGET,

# Path: kiwixbuild/versions.py



# Path: .github/scripts/ensure_base_deps.py
import os
import tarfile
from urllib.request import urlopen
from urllib.error import URLError
from kiwixbuild.versions import base_deps_meta_version
from common import (
    print_message,
    run_kiwix_build,
    upload,
    make_deps_archive,
    HOME,
    PLATFORM_TARGET,
    OS_NAME,
)

#!/usr/bin/env python3




def download_base_archive(base_name):
    url = "http://tmp.kiwix.org/ci/{}".format(base_name)
    file_path = str(HOME / base_name)
    batch_size = 1024 * 1024 * 8
    with urlopen(url) as resource, open(file_path, "wb") as file:
        while True:
            batch = resource.read(batch_size)
            if not batch:
                break
            print(".", end="", flush=True)
            file.write(batch)
    return file_path

ARCHIVE_NAME_TEMPLATE = "base_deps2_{os}_{platform}_{version}.tar.xz"

if PLATFORM_TARGET == 'flatpak':
    base_dep_archive_name = "base_deps2_{}_flatpak.tar.xz".format(OS_NAME)
else:
    base_dep_archive_name = ARCHIVE_NAME_TEMPLATE.format(
        os=OS_NAME,
        platform=PLATFORM_TARGET,

        version=base_deps_meta_version,