Print deprecation warnings on old style commands.

pull/2067/head
Jussi Pakkanen 7 years ago
parent fa278f351f
commit 59a35c4c53
  1. 2
      meson.py
  2. 9
      mesonbuild/mesonmain.py
  3. 6
      mesonconf.py
  4. 6
      mesonintrospect.py
  5. 5
      mesonrewriter.py
  6. 5
      mesontest.py
  7. 2
      run_tests.py
  8. 4
      run_unittests.py

@ -31,7 +31,7 @@ def main():
mlog.warning('Please switch to a UTF-8 locale for your platform.') 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. # Always resolve the command path so Ninja can find it for regen, tests, etc.
launcher = os.path.realpath(sys.argv[0]) launcher = os.path.realpath(sys.argv[0])
return mesonmain.run(launcher, sys.argv[1:]) return mesonmain.run(sys.argv[1:], launcher)
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

@ -17,10 +17,11 @@ import time, datetime
import os.path import os.path
from . import environment, interpreter, mesonlib from . import environment, interpreter, mesonlib
from . import build from . import build
from . import mconf, mintro, mtest, rewriter
import platform import platform
from . import mlog, coredata from . import mlog, coredata
from .mesonlib import MesonException from .mesonlib import MesonException
from .wrap import WrapMode from .wrap import WrapMode, wraptool
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -262,7 +263,7 @@ def run_script_command(args):
raise MesonException('Unknown internal command {}.'.format(cmdname)) raise MesonException('Unknown internal command {}.'.format(cmdname))
return cmdfunc(cmdargs) return cmdfunc(cmdargs)
def run(mainfile, args): def run(args, mainfile=None):
if sys.version_info < (3, 4): if sys.version_info < (3, 4):
print('Meson works correctly only with python 3.4+.') print('Meson works correctly only with python 3.4+.')
print('You have python %s.' % sys.version) print('You have python %s.' % sys.version)
@ -276,7 +277,7 @@ def run(mainfile, args):
return mtest.run(remaining_args) return mtest.run(remaining_args)
elif cmd_name == 'setup': elif cmd_name == 'setup':
args = remaining_args args = remaining_args
# FALLTROUGH like it's 1972. # FALLTHROUGH like it's 1972.
elif cmd_name == 'introspect': elif cmd_name == 'introspect':
return mintro.run(remaining_args) return mintro.run(remaining_args)
elif cmd_name == 'test': elif cmd_name == 'test':
@ -324,6 +325,8 @@ def run(mainfile, args):
else: else:
dir2 = '.' dir2 = '.'
try: try:
if mainfile is None:
sys.exit('I iz broken. Sorry.')
app = MesonApp(dir1, dir2, mainfile, handshake, options, sys.argv) app = MesonApp(dir1, dir2, mainfile, handshake, options, sys.argv)
except Exception as e: except Exception as e:
# Log directory does not exist, so just print # Log directory does not exist, so just print

@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from mesonbuild import mconf from mesonbuild import mesonmain, mlog
import sys import sys
sys.exit(mconf.run(sys.argv[1:])) if __name__ == '__main__':
mlog.warning('This executable is deprecated, use "meson configure" instead.')
sys.exit(mesonmain.run(['configure'] + sys.argv[1:]))

@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from mesonbuild import mintro from mesonbuild import mesonmain, mlog
import sys import sys
sys.exit(mintro.run(sys.argv[1:])) if __name__ == '__main__':
mlog.warning('This executable is deprecated. Use "meson introspect" instead.')
sys.exit(mesonmain.run(['introspect'] + sys.argv[1:]))

@ -23,9 +23,10 @@
# - move targets # - move targets
# - reindent? # - reindent?
from mesonbuild import rewriter from mesonbuild import mesonmain, mlog
import sys import sys
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(rewriter.run(sys.argv[1:])) mlog.warning('This program is deprecated, use "meson rewrite" instead')
sys.exit(mesonmain.run(['rewrite'] + sys.argv[1:]))

@ -16,10 +16,9 @@
# A tool to run tests in many different ways. # A tool to run tests in many different ways.
from mesonbuild import mesonmain from mesonbuild import mesonmain, mlog
import sys import sys
if __name__ == '__main__': if __name__ == '__main__':
print('Warning: This executable is deprecated. Use "meson test" instead.', mlog.warning('This executable is deprecated, use "meson test" instead.')
file=sys.stderr)
sys.exit(mesonmain.run(['test'] + sys.argv[1:])) sys.exit(mesonmain.run(['test'] + sys.argv[1:]))

@ -127,7 +127,7 @@ def run_configure_inprocess(commandlist):
old_stderr = sys.stderr old_stderr = sys.stderr
sys.stderr = mystderr = StringIO() sys.stderr = mystderr = StringIO()
try: try:
returncode = mesonmain.run(commandlist[0], commandlist[1:]) returncode = mesonmain.run(commandlist[1:], commandlist[0])
finally: finally:
sys.stdout = old_stdout sys.stdout = old_stdout
sys.stderr = old_stderr sys.stderr = old_stderr

@ -416,8 +416,8 @@ class BasePlatformTests(unittest.TestCase):
self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja')) self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja'))
self.meson_args = [os.path.join(src_root, 'meson.py'), '--backend=' + self.backend.name] self.meson_args = [os.path.join(src_root, 'meson.py'), '--backend=' + self.backend.name]
self.meson_command = [sys.executable] + self.meson_args self.meson_command = [sys.executable] + self.meson_args
self.mconf_command = [sys.executable, os.path.join(src_root, 'mesonconf.py')] self.mconf_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'configure']
self.mintro_command = [sys.executable, os.path.join(src_root, 'mesonintrospect.py')] self.mintro_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'introspect']
self.mtest_command = [sys.executable, os.path.join(src_root, 'mesontest.py'), '-C', self.builddir] self.mtest_command = [sys.executable, os.path.join(src_root, 'mesontest.py'), '-C', self.builddir]
# Backend-specific build commands # Backend-specific build commands
self.build_command, self.clean_command, self.test_command, self.install_command, \ self.build_command, self.clean_command, self.test_command, self.install_command, \

Loading…
Cancel
Save