aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-03-20 23:56:00 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2018-03-22 01:00:36 +0530
commit53d7613f0cc22c73a6caf382454b42223426917b (patch)
treee5eb8d17b30f6c98b9dcefe573dda2d97840a43e
parente3e54badfc8b0201db7d9ab956d0fef5f7402ab2 (diff)
downloadmeson-53d7613f0cc22c73a6caf382454b42223426917b.zip
meson-53d7613f0cc22c73a6caf382454b42223426917b.tar.gz
meson-53d7613f0cc22c73a6caf382454b42223426917b.tar.bz2
Do not install configure_file output if install_dir is empty. Closes #3270.
-rw-r--r--docs/markdown/Reference-manual.md3
-rw-r--r--mesonbuild/interpreter.py6
-rw-r--r--test cases/common/16 configure file/meson.build6
3 files changed, 12 insertions, 3 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index a02ad1c..e9ae5bf 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -173,7 +173,8 @@ These are all the supported keyword arguments:
mode, all the variables in the `configuration:` object (see above)
are written to the `output:` file.
- `install_dir` the subdirectory to install the generated file to
- (e.g. `share/myproject`), if omitted the file is not installed.
+ (e.g. `share/myproject`), if omitted or given the value of empty
+ string, the file is not installed.
- `output` the output file name (since v0.41.0, may contain
`@PLAINNAME@` or `@BASENAME@` substitutions). In configuration mode,
the permissions of the input file (if it is specified) are copied to
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e3680ac..1ac4be7 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2839,9 +2839,11 @@ root and issuing %s.
conffile = os.path.normpath(inputfile.relative_name())
if conffile not in self.build_def_files:
self.build_def_files.append(conffile)
- # Install file if requested
+ # Install file if requested, we check for the empty string
+ # for backwards compatibility. That was the behaviour before
+ # 0.45.0 so preserve it.
idir = kwargs.get('install_dir', None)
- if isinstance(idir, str):
+ if isinstance(idir, str) and idir:
cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname)
self.build.data.append(build.Data([cfile], idir))
return mesonlib.File.from_built_file(self.subdir, output)
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index eda0a8f..71a2563 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -131,3 +131,9 @@ configure_file(
configuration : conf6
)
test('test6', executable('prog6', 'prog6.c'))
+
+# test empty install dir string
+cfile = configure_file(input : 'config.h.in',
+ output : 'do_not_get_installed.h',
+ install_dir : '',
+ configuration : conf)