Build: macOS support for "make source_archive"

This commit is contained in:
Brecht Van Lommel 2024-02-11 02:47:26 +01:00
parent 5146e118c5
commit 3e0d77c80f
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import make_utils
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Iterable, TextIO, Optional, Any, Union
@ -176,9 +177,14 @@ def create_tarball(
packages_dir: Optional[Path],
) -> None:
print(f'Creating archive: "{tarball}" ...', end="", flush=True)
command = ["tar"]
# Requires GNU `tar`, since `--transform` is used.
if sys.platform == "darwin":
# Provided by `brew install gnu-tar`.
command = ["gtar"]
else:
command = ["tar"]
if packages_dir:
command += ["--transform", f"s,{packages_dir}/,packages/,g"]