dbus/tools/meson-compat-install-emptydirs.py
Simon McVittie 398820d1fe build: Change how we create empty directories from Meson
Use install_emptydir() in Meson versions that support it, or a script
with similar invocation in versions that do not. This will make it
straightforward to migrate to install_emptydir() when we drop support
for Meson versions older than 0.60.0.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00

19 lines
538 B
Python
Executable file

#!/usr/bin/env python3
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: MIT
# Compatibility shim for installing empty directories with Meson < 0.60
import os
import sys
from pathlib import Path
for d in sys.argv[1].split(':'):
if os.path.isabs(d) and 'DESTDIR' in os.environ:
p = Path(d)
d = p.relative_to(p.anchor)
dest = os.path.join(os.environ['DESTDIR'], d)
else:
dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d)
os.makedirs(dest, mode=0o755, exist_ok=True)