def run_configure_inprocess(commandlist, env=None): stderr = StringIO() stdout = StringIO() with mock.patch.dict(os.environ, env or {}), mock.patch.object(sys, 'stdout', stdout), mock.patch.object(sys, 'stderr', stderr): try: returncode = mesonmain.run(commandlist, get_meson_script()) finally: clear_meson_configure_class_caches() return returncode, stdout.getvalue(), stderr.getvalue()
def build_meson(sourcedir): from mesonbuild import mesonmain builddir = tempfile.mkdtemp() assert (mesonmain.run( [ "setup", "--prefix", builddir, "--libdir", builddir + "/lib", builddir, sourcedir, ], "meson", ) == 0) assert mesonmain.run(["compile", "-C", builddir], "meson") == 0 assert mesonmain.run(["install", "-C", builddir], "meson") == 0 return builddir
def run_configure_inprocess(commandlist): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() try: returncode = mesonmain.run(commandlist, get_meson_script()) finally: sys.stdout = old_stdout sys.stderr = old_stderr return returncode, mystdout.getvalue(), mystderr.getvalue()
def run_configure_inprocess(commandlist): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() try: returncode = mesonmain.run(commandlist[0], commandlist[1:]) finally: sys.stdout = old_stdout sys.stderr = old_stderr return (returncode, mystdout.getvalue(), mystderr.getvalue())
def run_configure_inprocess(commandlist): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() try: returncode = mesonmain.run(commandlist, get_meson_script()) finally: sys.stdout = old_stdout sys.stderr = old_stderr clear_meson_configure_class_caches() return returncode, mystdout.getvalue(), mystderr.getvalue()
def run_configure_inprocess( commandlist: T.List[str], env: T.Optional[T.Dict[str, str]] = None) -> T.Tuple[int, str, str]: stderr = StringIO() stdout = StringIO() with mock.patch.dict(os.environ, env or {}), mock.patch.object( sys, 'stdout', stdout), mock.patch.object(sys, 'stderr', stderr): try: returncode = mesonmain.run(commandlist, get_meson_script()) finally: clear_meson_configure_class_caches() return returncode, stdout.getvalue(), stderr.getvalue()
def main(): # Warn if the locale is not UTF-8. This can cause various unfixable issues # such as os.stat not being able to decode filenames with unicode in them. # There is no way to reset both the preferred encoding and the filesystem # encoding, so we can just warn about it. e = locale.getpreferredencoding() if e.upper() != 'UTF-8': mlog.warning('You are using {!r} which is not a a Unicode-compatible ' 'locale.'.format(e)) mlog.warning('You might see errors if you use UTF-8 strings as ' 'filenames, as strings, or as file contents.') mlog.warning('Please switch to a UTF-8 locale for your platform.') # Always resolve the command path so Ninja can find it for regen, tests, etc. launcher = os.path.realpath(sys.argv[0]) return mesonmain.run(launcher, sys.argv[1:])
def main(): # Warn if the locale is not UTF-8. This can cause various unfixable issues # such as os.stat not being able to decode filenames with unicode in them. # There is no way to reset both the preferred encoding and the filesystem # encoding, so we can just warn about it. e = locale.getpreferredencoding() if e.upper() != 'UTF-8' and not mesonlib.is_windows(): print('Warning: You are using {!r} which is not a a Unicode-compatible ' 'locale.'.format(e), file=sys.stderr) print('You might see errors if you use UTF-8 strings as ' 'filenames, as strings, or as file contents.', file=sys.stderr) print('Please switch to a UTF-8 locale for your platform.', file=sys.stderr) # Always resolve the command path so Ninja can find it for regen, tests, etc. launcher = os.path.realpath(sys.argv[0]) return mesonmain.run(sys.argv[1:], launcher)
def run_configure_inprocess(commandlist, env=None): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() old_stderr = sys.stderr sys.stderr = mystderr = StringIO() old_environ = os.environ.copy() if env is not None: os.environ.update(env) try: returncode = mesonmain.run(commandlist, get_meson_script()) finally: sys.stdout = old_stdout sys.stderr = old_stderr clear_meson_configure_class_caches() os.environ.clear() os.environ.update(old_environ) return returncode, mystdout.getvalue(), mystderr.getvalue()
def run_configure_inprocess( commandlist: T.List[str], env: T.Optional[T.Dict[str, str]] = None, catch_exception: bool = False) -> T.Tuple[int, str, str]: stderr = StringIO() stdout = StringIO() returncode = 0 with mock.patch.dict(os.environ, env or {}), mock.patch.object( sys, 'stdout', stdout), mock.patch.object(sys, 'stderr', stderr): try: returncode = mesonmain.run(commandlist, get_meson_script()) except Exception: if catch_exception: returncode = 1 traceback.print_exc() else: raise finally: clear_meson_configure_class_caches() return returncode, stdout.getvalue(), stderr.getvalue()
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from mesonbuild import mesonmain import sys if __name__ == '__main__': print( 'Warning: This executable is deprecated. Use "meson configure" instead.', file=sys.stderr) sys.exit(mesonmain.run(['configure'] + sys.argv[1:]))
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from mesonbuild import mesonmain import sys if __name__ == '__main__': print('Warning: This executable is deprecated. Use "meson introspect" instead.', file=sys.stderr) sys.exit(mesonmain.run(['introspect'] + sys.argv[1:]))
def main(): # Always resolve the command path so Ninja can find it for regen, tests, etc. launcher = os.path.realpath(sys.argv[0]) return mesonmain.run(launcher, sys.argv[1:])
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from mesonbuild import mesonmain import sys, os thisfile = __file__ if not os.path.isabs(thisfile): thisfile = os.path.normpath(os.path.join(os.getcwd(), thisfile)) sys.exit(mesonmain.run(thisfile, sys.argv[1:]))
def main(): # Always resolve the command path so Ninja can find it for regen, tests, etc. launcher = os.path.realpath(sys.argv[0]) return mesonmain.run(sys.argv[1:], launcher)
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # A tool to run tests in many different ways. from mesonbuild import mesonmain import sys if __name__ == '__main__': print('Warning: This executable is deprecated. Use "meson test" instead.', file=sys.stderr) sys.exit(mesonmain.run(['test'] + sys.argv[1:]))
def run_meson(args): "Runs a meson command logging output to process-iwyu.log" with open('process-iwyu.log', 'a') as sys.stdout: ret = mesonmain.run(args, abspath('meson')) sys.stdout = sys.__stdout__ return ret
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This class contains the basic functionality needed to run any interpreter # or an interpreter-based tool. # This tool is used to manipulate an existing Meson build definition. # # - add a file to a target # - remove files from a target # - move targets # - reindent? from mesonbuild import mesonmain import sys if __name__ == '__main__': print( 'Warning: This executable is deprecated. Use "meson rewrite" instead.', file=sys.stderr) sys.exit(mesonmain.run(['rewrite'] + sys.argv[1:]))
def meson_run(args, launcher): ret = mesonmain.run(args, launcher) if ret != 0: log.error('Meson error. Exiting.') sys.exit(1)
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This class contains the basic functionality needed to run any interpreter # or an interpreter-based tool. # This tool is used to manipulate an existing Meson build definition. # # - add a file to a target # - remove files from a target # - move targets # - reindent? from mesonbuild import mesonmain import sys if __name__ == '__main__': print('Warning: This executable is deprecated. Use "meson rewrite" instead.', file=sys.stderr) sys.exit(mesonmain.run(['rewrite'] + sys.argv[1:]))