diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-09 13:20:07 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-04-09 13:25:58 +0300 |
commit | 1feac3d6e3837ceb1bea25d8d9ef96d552b4f026 (patch) | |
tree | aaab6405cb967c7ef4c292f9ae7de3afa9d1b93b /mesonbuild/modules/python.py | |
parent | e5aa47d8af917282794a8da3956ce444b8d8378d (diff) | |
download | meson-intrcmd.zip meson-intrcmd.tar.gz meson-intrcmd.tar.bz2 |
Use a temp file to invoke the introspection command.intrcmd
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r-- | mesonbuild/modules/python.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 3bbccd1..91ee680 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -408,8 +408,13 @@ class PythonExternalProgram(ExternalProgram): def sanity(self, state: T.Optional['ModuleState'] = None) -> bool: # Sanity check, we expect to have something that at least quacks in tune - cmd = self.get_command() + ['-c', INTROSPECT_COMMAND] + from tempfile import NamedTemporaryFile + with NamedTemporaryFile(suffix='.py', delete=False, mode='w') as tf: + tmpfilename = tf.name + tf.write(INTROSPECT_COMMAND) + cmd = self.get_command() + [tmpfilename] p, stdout, stderr = mesonlib.Popen_safe(cmd) + os.unlink(tmpfilename) try: info = json.loads(stdout) except json.JSONDecodeError: |