INNER CODE UNIT · Python
get_missing_files
ivoyager/planetarium · web/post_export.py:75
def get_missing_files(name):
"""Return what the upload needs that EXPORT_DIR lacks. A .wasm or .pck already
gzipped isn't missing."""
missing_files = []
for ending in EXPORTED_ENDINGS:
if not (EXPORT_DIR / (name + ending)).is_file():
missing_files.append(name + ending)
for ending in GZIPPED_ENDINGS:
path = EXPORT_DIR / (name + ending)
if not path.is_file() and not path.with_name(path.name + ".gz").is_file():
missing_files.append(path.name)
htaccess_path = EXPORT_DIR / HTACCESS
if (not htaccess_path.is_file()
or HTACCESS_GZIP_LINE not in htaccess_path.read_text(encoding="utf-8")):
missing_files.append("the .htaccess in web/README.md")
return missing_files