Skip to content

Commit

Permalink
Write deprecation warnings to stderr.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Aug 2, 2017
1 parent 59a35c4 commit 20b57d6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
12 changes: 6 additions & 6 deletions meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions mesonconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]))
5 changes: 3 additions & 2 deletions mesonintrospect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]))
3 changes: 2 additions & 1 deletion mesonrewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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:]))

5 changes: 3 additions & 2 deletions mesontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]))

0 comments on commit 20b57d6

Please sign in to comment.