diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-09-26 02:30:26 -0400 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-09-29 04:44:01 -0400 |
commit | f2fed5052ddb7233df4ad49c0e83f6c8cad0cdf5 (patch) | |
tree | 45e580b3dfe7e628ab2123081d3b39979593e0f8 /mesonbuild/compilers.py | |
parent | 51341ce17758858b4578bb6c370f5ded6360ce43 (diff) | |
download | meson-f2fed5052ddb7233df4ad49c0e83f6c8cad0cdf5.zip meson-f2fed5052ddb7233df4ad49c0e83f6c8cad0cdf5.tar.gz meson-f2fed5052ddb7233df4ad49c0e83f6c8cad0cdf5.tar.bz2 |
Allow passing files to compile/link/run queries.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index e3ffba6..ec75b76 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -614,10 +614,13 @@ int main () {{ {1}; }}''' try: with tempfile.TemporaryDirectory() as tmpdirname: - srcname = os.path.join(tmpdirname, - 'testfile.' + self.default_suffix) - with open(srcname, 'w') as ofile: - ofile.write(code) + if isinstance(code, str): + srcname = os.path.join(tmpdirname, + 'testfile.' + self.default_suffix) + with open(srcname, 'w') as ofile: + ofile.write(code) + elif isinstance(code, mesonlib.File): + srcname = code.fname # Extension only matters if running results; '.exe' is # guaranteed to be executable on every platform. |