summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-05-05 11:53:54 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-05-05 11:53:54 +0200
commitf3a8d231863319ba8b221ca471175a040afef64b (patch)
tree4216b7455f0c53a21dfe54d18887bff4965754d1 /util
parent727241758e46b14cda6940e62651674d8748dc3f (diff)
downloadmm-common-f3a8d231863319ba8b221ca471175a040afef64b.tar.gz
Subprojects can use meson.add_dist_script() if meson.version() >= 0.58.0
* meson.build: * skeletonmm/doc/reference/meson.build: * skeletonmm/meson.build: * skeletonmm/skeleton/skeletonmm/meson.build: Call add_dist_script() in a subproject, if meson.version() >= 0.58.0. * util/build_scripts/dist-build-scripts.py: * util/build_scripts/dist-changelog.py: * util/build_scripts/doc-reference.py: * util/build_scripts/generate-binding.py: * util/meson_aux/extra-dist-cmd.py: Use MESON_PROJECT_DIST_ROOT if it exists, else MESON_DIST_ROOT. It exists if meson.version() >= 0.58.0.
Diffstat (limited to 'util')
-rwxr-xr-xutil/build_scripts/dist-build-scripts.py19
-rwxr-xr-xutil/build_scripts/dist-changelog.py4
-rwxr-xr-xutil/build_scripts/doc-reference.py7
-rwxr-xr-xutil/build_scripts/generate-binding.py7
-rwxr-xr-xutil/meson_aux/extra-dist-cmd.py6
5 files changed, 27 insertions, 16 deletions
diff --git a/util/build_scripts/dist-build-scripts.py b/util/build_scripts/dist-build-scripts.py
index 31aca50..a366a39 100755
--- a/util/build_scripts/dist-build-scripts.py
+++ b/util/build_scripts/dist-build-scripts.py
@@ -6,16 +6,17 @@
# dist-build-scripts.py <root_src_dir> <script_dir> <no_dist>...
# <script_dir> The directory with the build scripts, relative to <root_source_dir>.
-# <no_dist> Zero or more names (relative to MESON_DIST_ROOT) of files and
-# directories that shall not be distributed.
+# <no_dist> Zero or more names (relative to MESON_PROJECT_DIST_ROOT)
+# of files and directories that shall not be distributed.
import os
import sys
import shutil
-dist_root = os.getenv('MESON_DIST_ROOT')
+# MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
+project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
src_script_dir = os.path.join(sys.argv[1], sys.argv[2])
-dist_script_dir = os.path.join(dist_root, sys.argv[2])
+dist_script_dir = os.path.join(project_dist_root, sys.argv[2])
# Create the distribution script directory, if it does not exist.
os.makedirs(dist_script_dir, exist_ok=True)
@@ -32,12 +33,12 @@ for file in files:
shutil.copy(os.path.join(src_script_dir, file), dist_script_dir)
# Don't distribute .gitignore files.
-for dirpath, dirnames, filenames in os.walk(dist_root):
+for dirpath, dirnames, filenames in os.walk(project_dist_root):
if '.gitignore' in filenames:
os.remove(os.path.join(dirpath, '.gitignore'))
-# Remove an empty MESON_DIST_ROOT/build directory.
-dist_build_dir = os.path.join(dist_root, 'build')
+# Remove an empty MESON_PROJECT_DIST_ROOT/build directory.
+dist_build_dir = os.path.join(project_dist_root, 'build')
if os.path.isdir(dist_build_dir):
try:
os.rmdir(dist_build_dir)
@@ -45,9 +46,9 @@ if os.path.isdir(dist_build_dir):
# Ignore the error, if not empty.
pass
-# Remove specified files and directories from the MESON_DIST_ROOT directory.
+# Remove specified files and directories from the MESON_PROJECT_DIST_ROOT directory.
for rel_path in sys.argv[3:]:
- abs_path = os.path.join(dist_root, rel_path)
+ abs_path = os.path.join(project_dist_root, rel_path)
if os.path.isfile(abs_path):
os.remove(abs_path)
elif os.path.isdir(abs_path):
diff --git a/util/build_scripts/dist-changelog.py b/util/build_scripts/dist-changelog.py
index 4a11a5f..5eecb1a 100755
--- a/util/build_scripts/dist-changelog.py
+++ b/util/build_scripts/dist-changelog.py
@@ -20,5 +20,7 @@ cmd = [
'--max-count=200',
'--pretty=tformat:%cd %an <%ae>%n%n %s%n%w(0,0,2)%+b',
]
-with open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w') as logfile:
+# MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
+project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
+with open(os.path.join(project_dist_root, 'ChangeLog'), mode='w') as logfile:
sys.exit(subprocess.run(cmd, stdout=logfile).returncode)
diff --git a/util/build_scripts/doc-reference.py b/util/build_scripts/doc-reference.py
index c9a3a80..9769688 100755
--- a/util/build_scripts/doc-reference.py
+++ b/util/build_scripts/doc-reference.py
@@ -142,10 +142,13 @@ def dist_doc():
# argv[3] argv[4] argv[5] argv[6]
# <doctool_dist_dir> <doc_ref_build_dir> <tagfile> <devhelpfile>
- # <doctool_dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
+ # <doctool_dist_dir> is a distribution directory, relative to MESON_PROJECT_DIST_ROOT.
# <doc_ref_build_dir> is a relative or absolute path in the build directory.
# <tagfile> and <devhelpfile> are relative or absolute paths in the build directory.
- doctool_dist_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
+
+ # MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
+ project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
+ doctool_dist_dir = os.path.join(project_dist_root, sys.argv[3])
doc_ref_build_dir = sys.argv[4]
tagfile = sys.argv[5]
devhelpfile = sys.argv[6]
diff --git a/util/build_scripts/generate-binding.py b/util/build_scripts/generate-binding.py
index c88bc5c..6d719ff 100755
--- a/util/build_scripts/generate-binding.py
+++ b/util/build_scripts/generate-binding.py
@@ -117,9 +117,12 @@ def dist_built_files():
# <built_h_cc_dir> <dist_dir> <basefilenames>...
# <built_h_cc_dir> is an absolute path in the build directory or source directory.
- # <dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
+ # <dist_dir> is a distribution directory, relative to MESON_PROJECT_DIST_ROOT.
+
+ # MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
+ project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
built_h_cc_dir = sys.argv[2]
- dist_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
+ dist_dir = os.path.join(project_dist_root, sys.argv[3])
# Create the distribution directory, if it does not exist.
os.makedirs(os.path.join(dist_dir, 'private'), exist_ok=True)
diff --git a/util/meson_aux/extra-dist-cmd.py b/util/meson_aux/extra-dist-cmd.py
index 484f4e9..ff2c230 100755
--- a/util/meson_aux/extra-dist-cmd.py
+++ b/util/meson_aux/extra-dist-cmd.py
@@ -27,12 +27,14 @@ cmd = [
'--max-count=200',
'--pretty=tformat:%cd %an <%ae>%n%n %s%n%w(0,0,2)%+b',
]
-with open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w') as logfile:
+# MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
+project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
+with open(os.path.join(project_dist_root, 'ChangeLog'), mode='w') as logfile:
result = subprocess.run(cmd, stdout=logfile)
# Distribute the libstdc++.tag file in addition to the files in the local git clone.
# shutil.copy2() copies timestamps and some other file metadata.
shutil.copy2(os.path.join(root_build_dir, 'libstdc++.tag'),
- os.path.join(os.getenv('MESON_DIST_ROOT'), 'doctags'))
+ os.path.join(project_dist_root, 'doctags'))
sys.exit(result.returncode)