INNER CODE UNIT · Python

delete_boot_splash

ivoyager/planetarium · web/post_export.py:127

def delete_boot_splash(path):
    if not path.is_file():
        return
    path.unlink()
    print(f"{path.name}: deleted")


def zip_upload(name, zip_path):
    """Zip the files the server needs, replacing any earlier zip of that name."""
    file_names = [HTACCESS, SPLASH_IMAGE.name]
    file_names += [name + ending for ending in EXPORTED_ENDINGS]
    file_names += [name + ending + ".gz" for ending in GZIPPED_ENDINGS]
    with zipfile.ZipFile(zip_path, "w") as archive:
        for file_name in file_names:
            # Deflating a .gz again would only cost time.
            compress_type = zipfile.ZIP_STORED if file_name.endswith(".gz") else zipfile.ZIP_DEFLATED
            archive.write(EXPORT_DIR / file_name, file_name, compress_type)
    print(f"{zip_path.name}: {len(file_names)} files, {zip_path.stat().st_size / 1e6:.1f} MB")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…