diff options
author | Luke Drummond <ldrumm@rtps.co> | 2020-11-03 20:28:04 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-02-04 17:34:11 +0000 |
commit | 46e3480f7c675b140ca4496c658069696daa176d (patch) | |
tree | 7968ab2078864ecf71212cf291abb462d081596f /mesonbuild/interpreter.py | |
parent | 95c079071118abc9078b0931ee86f51b1b4f8e05 (diff) | |
download | meson-46e3480f7c675b140ca4496c658069696daa176d.zip meson-46e3480f7c675b140ca4496c658069696daa176d.tar.gz meson-46e3480f7c675b140ca4496c658069696daa176d.tar.bz2 |
Introduce `fs.read` to read a file as a string
Following #7890, this patch introduces the ability to read the contents
of a file to the fs module.
This patch introduces the ability to read files at configure time, but
has some restrictions:
- binary files are not supported (I don't think this will prove a
problem, and if people are wanting to do something with binary
files, they should probably be shelling out to their own script).
- Only files outside the build directory allowed. This limitation
should prevent build loops.
Given that reading an arbitrary file at configure time can affect the
configuration in almost arbitrary ways, meson should force a reconfigure
when the given file changes. This is non-configurable, but this can
easily be changed with a future keyword argument.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 0ce0fe8..c9b6e9a 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2617,7 +2617,7 @@ class Interpreter(InterpreterBase): def get_build_def_files(self) -> T.List[str]: return self.build_def_files - def add_build_def_file(self, f): + def add_build_def_file(self, f: mesonlib.FileOrString) -> None: # Use relative path for files within source directory, and absolute path # for system files. Skip files within build directory. Also skip not regular # files (e.g. /dev/stdout) Normalize the path to avoid duplicates, this |