diff --git a/meson.py b/meson.py index ca29d1876..64dcc365f 100755 --- a/meson.py +++ b/meson.py @@ -31,7 +31,7 @@ def main(): 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:]) + return mesonmain.run(sys.argv[1:], launcher) if __name__ == '__main__': sys.exit(main()) diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 9f7bb0b64..ed23f5238 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -17,10 +17,11 @@ import time, datetime import os.path from . import environment, interpreter, mesonlib from . import build +from . import mconf, mintro, mtest, rewriter import platform from . import mlog, coredata from .mesonlib import MesonException -from .wrap import WrapMode +from .wrap import WrapMode, wraptool parser = argparse.ArgumentParser() @@ -262,7 +263,7 @@ def run_script_command(args): raise MesonException('Unknown internal command {}.'.format(cmdname)) return cmdfunc(cmdargs) -def run(mainfile, args): +def run(args, mainfile=None): if sys.version_info < (3, 4): print('Meson works correctly only with python 3.4+.') print('You have python %s.' % sys.version) @@ -276,7 +277,7 @@ def run(mainfile, args): return mtest.run(remaining_args) elif cmd_name == 'setup': args = remaining_args - # FALLTROUGH like it's 1972. + # FALLTHROUGH like it's 1972. elif cmd_name == 'introspect': return mintro.run(remaining_args) elif cmd_name == 'test': @@ -324,6 +325,8 @@ def run(mainfile, args): else: dir2 = '.' try: + if mainfile is None: + sys.exit('I iz broken. Sorry.') app = MesonApp(dir1, dir2, mainfile, handshake, options, sys.argv) except Exception as e: # Log directory does not exist, so just print diff --git a/mesonconf.py b/mesonconf.py index 2b0a1a61f..732a3b252 100755 --- a/mesonconf.py +++ b/mesonconf.py @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import mconf +from mesonbuild import mesonmain, mlog 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:])) diff --git a/mesonintrospect.py b/mesonintrospect.py index 4d20548b1..3a21c5e78 100755 --- a/mesonintrospect.py +++ b/mesonintrospect.py @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import mintro +from mesonbuild import mesonmain, mlog 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:])) diff --git a/mesonrewriter.py b/mesonrewriter.py index 7c8fdb1dd..e5b0155a8 100755 --- a/mesonrewriter.py +++ b/mesonrewriter.py @@ -23,9 +23,10 @@ # - move targets # - reindent? -from mesonbuild import rewriter +from mesonbuild import mesonmain, mlog import sys 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:])) diff --git a/mesontest.py b/mesontest.py index c2d39d69a..e0ba7c20e 100755 --- a/mesontest.py +++ b/mesontest.py @@ -16,10 +16,9 @@ # A tool to run tests in many different ways. -from mesonbuild import mesonmain +from mesonbuild import mesonmain, mlog import sys if __name__ == '__main__': - print('Warning: This executable is deprecated. Use "meson test" instead.', - file=sys.stderr) + mlog.warning('This executable is deprecated, use "meson test" instead.') sys.exit(mesonmain.run(['test'] + sys.argv[1:])) diff --git a/run_tests.py b/run_tests.py index 040f9587f..e678d37bf 100755 --- a/run_tests.py +++ b/run_tests.py @@ -127,7 +127,7 @@ def run_configure_inprocess(commandlist): old_stderr = sys.stderr sys.stderr = mystderr = StringIO() try: - returncode = mesonmain.run(commandlist[0], commandlist[1:]) + returncode = mesonmain.run(commandlist[1:], commandlist[0]) finally: sys.stdout = old_stdout sys.stderr = old_stderr diff --git a/run_unittests.py b/run_unittests.py index 12b5278e9..5782c1d9d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -416,8 +416,8 @@ class BasePlatformTests(unittest.TestCase): 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_command = [sys.executable] + self.meson_args - self.mconf_command = [sys.executable, os.path.join(src_root, 'mesonconf.py')] - self.mintro_command = [sys.executable, os.path.join(src_root, 'mesonintrospect.py')] + self.mconf_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'configure'] + 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] # Backend-specific build commands self.build_command, self.clean_command, self.test_command, self.install_command, \