From 20b57d6e1560d0eb6d9dfc455de41b8352bcb39f Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 17 Jul 2017 18:39:36 +0300 Subject: [PATCH] Write deprecation warnings to stderr. --- meson.py | 12 ++++++------ mesonconf.py | 5 +++-- mesonintrospect.py | 5 +++-- mesonrewriter.py | 3 ++- mesontest.py | 5 +++-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/meson.py b/meson.py index 64dcc365f..d1b629d6f 100755 --- a/meson.py +++ b/meson.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import mlog, mesonmain, mesonlib +from mesonbuild import mesonmain, mesonlib import sys, os, locale def main(): @@ -24,11 +24,11 @@ def main(): # encoding, so we can just warn about it. e = locale.getpreferredencoding() if e.upper() != 'UTF-8' and not mesonlib.is_windows(): - 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.') + 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) diff --git a/mesonconf.py b/mesonconf.py index 732a3b252..d1874e0e3 100755 --- a/mesonconf.py +++ b/mesonconf.py @@ -14,9 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import mesonmain, mlog +from mesonbuild import mesonmain import sys if __name__ == '__main__': - mlog.warning('This executable is deprecated, use "meson configure" instead.') + print('Warning: This executable is deprecated. Use "meson configure" instead.', + file=sys.stderr) sys.exit(mesonmain.run(['configure'] + sys.argv[1:])) diff --git a/mesonintrospect.py b/mesonintrospect.py index 3a21c5e78..5cc07bfb7 100755 --- a/mesonintrospect.py +++ b/mesonintrospect.py @@ -14,9 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import mesonmain, mlog +from mesonbuild import mesonmain import sys if __name__ == '__main__': - mlog.warning('This executable is deprecated. Use "meson introspect" instead.') + print('Warning: This executable is deprecated. Use "meson introspect" instead.', + file=sys.stderr) sys.exit(mesonmain.run(['introspect'] + sys.argv[1:])) diff --git a/mesonrewriter.py b/mesonrewriter.py index e5b0155a8..426d87848 100755 --- a/mesonrewriter.py +++ b/mesonrewriter.py @@ -27,6 +27,7 @@ from mesonbuild import mesonmain, mlog import sys if __name__ == '__main__': - mlog.warning('This program is deprecated, use "meson rewrite" instead') + print('Warning: This executable is deprecated. Use "meson rewrite" instead.', + file=sys.stderr) sys.exit(mesonmain.run(['rewrite'] + sys.argv[1:])) diff --git a/mesontest.py b/mesontest.py index e0ba7c20e..c2d39d69a 100755 --- a/mesontest.py +++ b/mesontest.py @@ -16,9 +16,10 @@ # A tool to run tests in many different ways. -from mesonbuild import mesonmain, mlog +from mesonbuild import mesonmain import sys if __name__ == '__main__': - mlog.warning('This executable is deprecated, use "meson test" instead.') + print('Warning: This executable is deprecated. Use "meson test" instead.', + file=sys.stderr) sys.exit(mesonmain.run(['test'] + sys.argv[1:]))