from pathlib import Path
from typing import List
import tarfile


def make_tar_gz(tmpdir: Path, relative_paths: List[Path]) -> Path:
    """
    Make a .tar.gz archive from a list of relative paths.
    Create empty files at each path and add them to the archive.
    """
    tar_path = tmpdir / "test.tar.gz"
    with tarfile.open(tar_path, "w:gz") as z:
        for relative_path in relative_paths:
            full_path = tmpdir / relative_path
            full_path.parent.mkdir(exist_ok=True, parents=True)
            full_path.touch()
            z.add(str(full_path), arcname=str(relative_path), recursive=False)

    return tar_path