Moved scripts in the module and started work to run them via the main meson command.

pull/356/head
Jussi Pakkanen 9 years ago
parent d2a14075b3
commit 66c01401de
  1. 22
      meson.py
  2. 2
      meson/environment.py
  3. 58
      meson/mesonmain.py
  4. 2
      meson/modules/gnome.py
  5. 11
      meson/ninjabackend.py
  6. 12
      meson/scripts/commandrunner.py
  7. 11
      meson/scripts/delwithsuffix.py
  8. 15
      meson/scripts/depfixer.py
  9. 10
      meson/scripts/dirchanger.py
  10. 10
      meson/scripts/gtkdochelper.py
  11. 0
      meson/scripts/meson_benchmark.py
  12. 11
      meson/scripts/meson_install.py
  13. 2
      meson/scripts/meson_test.py
  14. 9
      meson/scripts/regen_checker.py
  15. 12
      meson/scripts/symbolextractor.py
  16. 11
      meson/scripts/vcstagger.py
  17. 0
      mesonconf.py
  18. 0
      mesongui.py
  19. 0
      mesonintrospect.py
  20. 0
      wraptool.py

@ -1,6 +1,24 @@
#!/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 meson import mesonmain
import sys
import sys, os
thisfile = __file__
if not os.path.isabs(thisfile):
thisfile = os.path.join(os.getcwd(), thisfile)
sys.exit(mesonmain.run(sys.argv[:]))
sys.exit(mesonmain.run(thisfile, sys.argv[1:]))

@ -1,4 +1,4 @@
# Copyright 2012-2014 The Meson development team
# Copyright 2012-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.

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2012-2015 The Meson development team
# Copyright 2012-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.
@ -163,21 +163,58 @@ itself as required.'''
dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
pickle.dump(b, open(dumpfile, 'wb'))
def run(args):
def run_script_command(args):
cmdname = args[0]
cmdargs = args[1:]
if cmdname == 'test':
import meson.scripts.meson_test as abc
cmdfunc = abc.run
elif cmdname == 'benchmark':
import meson.scripts.meson_benchmark as abc
cmdfunc = abc.run
elif cmdname == 'commandrunner':
import meson.scripts.commandrunner as abc
cmdfunc = abc.run
elif cmdname == 'delsuffix':
import meson.scripts.delwithsuffix as abc
cmdfunc = abc.run
elif cmdname == 'dirchanger':
import meson.scripts.dirchanger as abc
cmdfunc = abc.run
elif cmdname == 'gtkdoc':
import meson.scripts.gtkdochelper as abc
cmdfunc = abc.run
elif cmdname == 'regencheck':
import meson.scripts.regen_checker as abc
cmdfunc = abc.run
elif cmdname == 'symbolextractor':
import meson.scripts.symbolextractor as abc
cmdfunc = abc.run
elif cmdname == 'vcstagger':
import meson.scripts.vcstagger as abc
cmdfunc = abc.run
else:
raise MesonException('Unknown internal command {}.'.format(cmdname))
return cmdfunc(cmdargs)
def run(mainfile, args):
if sys.version_info < (3, 3):
print('Meson works correctly only with python 3.3+.')
print('You have python %s.' % sys.version)
print('Please update your environment')
return 1
if args[-1] == 'secret-handshake':
args = args[:-1]
if args[0] == '--internal':
if args[1] != 'regenerate':
sys.exit(run_script_command(args[1:]))
args = args[2:]
handshake = True
else:
handshake = False
print(args)
args = mesonlib.expand_arguments(args)
if not args:
return 1
options = parser.parse_args(args[1:])
options = parser.parse_args(args)
if options.print_version:
print(coredata.version)
return 0
@ -191,16 +228,15 @@ def run(args):
dir2 = args[1]
else:
dir2 = '.'
this_file = os.path.abspath(__file__)
while os.path.islink(this_file):
resolved = os.readlink(this_file)
while os.path.islink(mainfile):
resolved = os.readlink(mainfile)
if resolved[0] != '/':
this_file = os.path.join(os.path.dirname(this_file), resolved)
mainfile = os.path.join(os.path.dirname(mainfile), resolved)
else:
this_file = resolved
mainfile = resolved
try:
app = MesonApp(dir1, dir2, this_file, handshake, options)
app = MesonApp(dir1, dir2, mainfile, handshake, options)
except Exception as e:
# Log directory does not exist, so just print
# to stdout.

@ -1,4 +1,4 @@
# Copyright 2015 The Meson development team
# Copyright 2015-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.

@ -1,4 +1,4 @@
# Copyright 2012-2014 The Meson development team
# Copyright 2012-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.
@ -582,9 +582,8 @@ int dummy;
self.serialise_tests()
valgrind = environment.find_valgrind()
script_root = self.environment.get_script_dir()
test_script = os.path.join(script_root, 'meson_test.py')
test_data = os.path.join(self.environment.get_scratch_dir(), 'meson_test_setup.dat')
cmd = [sys.executable, test_script, test_data]
cmd = [sys.executable, self.environment.get_build_command(), '--internal', 'test', test_data]
elem = NinjaBuildElement('test', 'CUSTOM_COMMAND', ['all', 'PHONY'])
elem.add_item('COMMAND', cmd)
elem.add_item('DESC', 'Running all tests.')
@ -604,7 +603,7 @@ int dummy;
# And then benchmarks.
benchmark_script = os.path.join(script_root, 'meson_benchmark.py')
benchmark_data = os.path.join(self.environment.get_scratch_dir(), 'meson_benchmark_setup.dat')
cmd = [sys.executable, benchmark_script, benchmark_data]
cmd = [sys.executable, self.environment.get_build_command(), '--internal', 'benchmark', benchmark_data]
elem = NinjaBuildElement('benchmark', 'CUSTOM_COMMAND', ['all', 'PHONY'])
elem.add_item('COMMAND', cmd)
elem.add_item('DESC', 'Running benchmark suite.')
@ -628,9 +627,11 @@ int dummy;
outfile.write('rule REGENERATE_BUILD\n')
c = (quote_char + ninja_quote(sys.executable) + quote_char,
quote_char + ninja_quote(self.environment.get_build_command()) + quote_char,
'--internal',
'regenerate',
quote_char + ninja_quote(self.environment.get_source_dir()) + quote_char,
quote_char + ninja_quote(self.environment.get_build_dir()) + quote_char)
outfile.write(" command = %s %s %s %s --backend ninja secret-handshake\n" % c)
outfile.write(" command = %s %s %s %s %s %s --backend ninja\n" % c)
outfile.write(' description = Regenerating build files\n')
outfile.write(' generator = 1\n\n')
if len(self.build.pot) > 0:

@ -42,9 +42,10 @@ def run_command(source_dir, build_dir, subdir, command, arguments):
print('Could not execute command "%s".' % command)
sys.exit(1)
if __name__ == '__main__':
if len(sys.argv) < 5:
print(sys.argv[0], '<source dir> <build dir> <subdir> <command> [arguments]')
def run(args):
if len(sys.argv) < 4:
print('commandrunner.py <source dir> <build dir> <subdir> <command> [arguments]')
sys.exit(1)
src_dir = sys.argv[1]
build_dir = sys.argv[2]
subdir = sys.argv[3]
@ -52,4 +53,7 @@ if __name__ == '__main__':
arguments = sys.argv[5:]
pc = run_command(src_dir, build_dir, subdir, command, arguments)
pc.wait()
sys.exit(pc.returncode)
return pc.returncode
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -16,8 +16,9 @@
import os, sys
if len(sys.argv) != 3:
print('%s <root of subdir to process> <suffix to delete>' % sys.argv[0])
def run(args):
if len(sys.argv) != 2:
print('delwithsuffix.py <root of subdir to process> <suffix to delete>')
sys.exit(1)
topdir = sys.argv[1]
@ -25,8 +26,12 @@ suffix = sys.argv[2]
if suffix[0] != '.':
suffix = '.' + suffix
for (root, dirs, files) in os.walk(topdir):
for (root, _, files) in os.walk(topdir):
for f in files:
if f.endswith(suffix):
fullname = os.path.join(root, f)
os.unlink(fullname)
return 0
if __name__ == '__main__':
run(sys.argv[1:])

@ -284,16 +284,19 @@ class Elf(DataSizes):
entry.write(self.bf)
return None
if __name__ == '__main__':
if len(sys.argv) < 2 or len(sys.argv) > 3:
def run(args):
if len(args) < 1 or len(args) > 2:
print('This application resets target rpath.')
print('Don\'t run this unless you know what you are doing.')
print('%s: <binary file> <prefix>' % sys.argv[0])
exit(1)
e = Elf(sys.argv[1])
if len(sys.argv) == 2:
e = Elf(args[0])
if len(args) == 1:
e.print_rpath()
else:
new_rpath = sys.argv[2]
new_rpath = args[1]
e.fix_rpath(new_rpath.encode('utf8'))
#e.fix_deps(prefix.encode())
return 0
if __name__ == '__main__':
run(sys.argv[1:])

@ -19,8 +19,12 @@ the command given in the rest of the arguments.'''
import os, subprocess, sys
dirname = sys.argv[1]
command = sys.argv[2:]
def run(args):
dirname = args[0]
command = args[1:]
os.chdir(dirname)
sys.exit(subprocess.call(command))
return subprocess.call(command)
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Copyright 2015 The Meson development team
# Copyright 2015-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.
@ -87,8 +87,8 @@ def install_gtkdoc(build_root, doc_subdir, install_prefix, datadir, module):
shutil.rmtree(final_destination, ignore_errors=True)
shutil.copytree(source, final_destination)
if __name__ == '__main__':
options = parser.parse_args(sys.argv[1:])
def run(args):
options = parser.parse_args(args)
if len(options.htmlargs) > 0:
htmlargs = options.htmlargs.split('@@')
else:
@ -116,3 +116,7 @@ if __name__ == '__main__':
installdir,
'share/gtk-doc/html',
options.modulename)
return 0
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -203,10 +203,13 @@ def install_targets(d):
print('Stderr:\n%s\n' % stde.decode())
sys.exit(1)
if __name__ == '__main__':
if len(sys.argv) != 2:
def run(args):
if len(args) != 1:
print('Installer script for Meson. Do not run on your own, mmm\'kay?')
print('%s [install info file]' % sys.argv[0])
datafilename = sys.argv[1]
print('meson_install.py [install info file]')
datafilename = args[0]
do_install(datafilename)
return 0
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2013-2015 The Meson development team
# Copyright 2013-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.

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2015 The Meson development team
# Copyright 2015-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.
@ -35,8 +35,11 @@ def regen(regeninfo):
'--backend=vs2010', 'secret-handshake']
subprocess.check_call(cmd)
if __name__ == '__main__':
regeninfo = pickle.load(open(os.path.join(sys.argv[1], 'regeninfo.dump'), 'rb'))
def run(args):
regeninfo = pickle.load(open(os.path.join(args[0], 'regeninfo.dump'), 'rb'))
if need_regen(regeninfo):
regen(regeninfo)
sys.exit(0)
if __name__ == '__main__':
run(sys.argv[1:])

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2013-2015 The Meson development team
# Copyright 2013-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.
@ -92,11 +92,15 @@ def gen_symbols(libfilename, outfilename, cross_host):
else:
dummy_syms(outfilename)
if __name__ == '__main__':
options = parser.parse_args()
def run(args):
options = parser.parse_args(args)
if len(options.args) != 2:
print(sys.argv[0], '<shared library file> <output file>')
print('symbolextractor.py <shared library file> <output file>')
sys.exit(1)
libfile = options.args[0]
outfile = options.args[1]
gen_symbols(libfile, outfile, options.cross_host)
return 0
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2015 The Meson development team
# Copyright 2015-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.
@ -27,7 +27,10 @@ def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_
if (not os.path.exists(outfile)) or (open(outfile).read() != new_data):
open(outfile, 'w').write(new_data)
if __name__ == '__main__':
infile, outfile, fallback, source_dir, replace_string, regex_selector = sys.argv[1:7]
command = sys.argv[7:]
def run(args):
infile, outfile, fallback, source_dir, replace_string, regex_selector = args[0:6]
command = args[6:]
config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, command)
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))
Loading…
Cancel
Save