aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--MANIFEST.in15
-rwxr-xr-xcreate_release.sh5
-rwxr-xr-xinstall_meson.py120
-rwxr-xr-xmeson (renamed from delwithsuffix.py)22
-rw-r--r--mesonbuild/__init__.py0
-rw-r--r--mesonbuild/backends.py (renamed from backends.py)23
-rw-r--r--mesonbuild/build.py (renamed from build.py)10
-rw-r--r--mesonbuild/compilers.py (renamed from compilers.py)8
-rw-r--r--mesonbuild/coredata.py (renamed from coredata.py)2
-rw-r--r--mesonbuild/dependencies.py (renamed from dependencies.py)6
-rw-r--r--mesonbuild/environment.py (renamed from environment.py)8
-rw-r--r--mesonbuild/interpreter.py (renamed from interpreter.py)33
-rw-r--r--[-rwxr-xr-x]mesonbuild/mconf.py (renamed from mesonconf.py)30
-rw-r--r--mesonbuild/mesonlib.py (renamed from mesonlib.py)15
-rw-r--r--[-rwxr-xr-x]mesonbuild/mesonmain.py (renamed from meson.py)86
-rw-r--r--mesonbuild/mesonmain.ui (renamed from mesonmain.ui)0
-rw-r--r--mesonbuild/mesonrunner.ui (renamed from mesonrunner.ui)0
-rw-r--r--mesonbuild/mesonstart.ui (renamed from mesonstart.ui)0
-rw-r--r--[-rwxr-xr-x]mesonbuild/mgui.py (renamed from mesongui.py)26
-rw-r--r--[-rwxr-xr-x]mesonbuild/mintro.py (renamed from mesonintrospect.py)16
-rw-r--r--mesonbuild/mlog.py (renamed from mlog.py)0
-rw-r--r--mesonbuild/modules/__init__.py0
-rw-r--r--mesonbuild/modules/gnome.py (renamed from modules/gnome.py)18
-rw-r--r--mesonbuild/modules/modtest.py (renamed from modules/modtest.py)0
-rw-r--r--mesonbuild/modules/pkgconfig.py (renamed from modules/pkgconfig.py)4
-rw-r--r--mesonbuild/modules/qt4.py (renamed from modules/qt4.py)6
-rw-r--r--mesonbuild/modules/qt5.py (renamed from modules/qt5.py)6
-rw-r--r--mesonbuild/modules/rpm.py (renamed from modules/rpm.py)9
-rw-r--r--mesonbuild/modules/windows.py (renamed from modules/windows.py)4
-rw-r--r--mesonbuild/mparser.py (renamed from mparser.py)2
-rw-r--r--mesonbuild/ninjabackend.py (renamed from ninjabackend.py)46
-rw-r--r--mesonbuild/optinterpreter.py (renamed from optinterpreter.py)4
-rw-r--r--mesonbuild/scripts/__init__.py0
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/commandrunner.py (renamed from commandrunner.py)22
-rw-r--r--mesonbuild/scripts/delwithsuffix.py37
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/depfixer.py (renamed from depfixer.py)15
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/dirchanger.py (renamed from dirchanger.py)12
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/gtkdochelper.py (renamed from gtkdochelper.py)10
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/meson_benchmark.py (renamed from meson_benchmark.py)2
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/meson_install.py (renamed from meson_install.py)28
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/meson_test.py (renamed from meson_test.py)11
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/regen_checker.py (renamed from regen_checker.py)9
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/symbolextractor.py (renamed from symbolextractor.py)14
-rw-r--r--[-rwxr-xr-x]mesonbuild/scripts/vcstagger.py (renamed from vcstagger.py)11
-rw-r--r--mesonbuild/vs2010backend.py (renamed from vs2010backend.py)8
-rw-r--r--mesonbuild/wrap/__init__.py0
-rw-r--r--mesonbuild/wrap/wrap.py (renamed from wrap.py)40
-rwxr-xr-xmesonbuild/wrap/wraptool.py (renamed from wraptool.py)67
-rw-r--r--mesonbuild/xcodebackend.py (renamed from xcodebackend.py)6
-rwxr-xr-xmesonconf20
-rwxr-xr-xmesongui20
-rwxr-xr-xmesonintrospect20
-rw-r--r--readme.txt13
-rwxr-xr-xrun_cross_test.py4
-rwxr-xr-xrun_tests.py17
-rw-r--r--setup.py60
-rwxr-xr-xwraptool20
58 files changed, 579 insertions, 416 deletions
diff --git a/.gitignore b/.gitignore
index 4df65c8..1e42da4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,8 @@ __pycache__
.DS_Store
*~
packagecache
+/MANIFEST
+/build
+/dist
+/meson.egg-info
+
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..8d8f136
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,15 @@
+graft test?cases
+graft manual?tests
+graft cross
+graft data
+graft graphics
+graft man
+graft tools
+include run_tests.py
+include run_cross_test.py
+include readme.txt
+include authors.txt
+include contributing.txt
+include COPYING
+include run_cross_test.py
+include run_tests.py
diff --git a/create_release.sh b/create_release.sh
deleted file mode 100755
index 0a04454..0000000
--- a/create_release.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-version=`./meson.py -v`
-git archive --prefix meson-${version}/ HEAD | gzip > meson_${version}.tar.gz
-
diff --git a/install_meson.py b/install_meson.py
deleted file mode 100755
index f942a9b..0000000
--- a/install_meson.py
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2013-2014 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.
-
-# This script installs Meson. We can't use Meson to install itself
-# because of the bootstrap problem. We can't use any other build system
-# either becaust that would be just silly.
-
-import os, sys, glob, shutil, gzip
-import argparse
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument('--prefix', default='/usr/local', dest='prefix',
- help='the installation prefix (default: %(default)s)')
-parser.add_argument('--destdir', default='', dest='destdir',
- help='the destdir (default: %(default)s)')
-
-options = parser.parse_args()
-if options.prefix[0] != '/':
- print('Error, prefix must be an absolute path.')
- sys.exit(1)
-
-if options.destdir == '':
- install_root = options.prefix
-else:
- install_root = os.path.join(options.destdir, options.prefix[1:])
-
-script_dir = os.path.join(install_root, 'share/meson')
-module_dir = os.path.join(script_dir, 'modules')
-bin_dir = os.path.join(install_root, 'bin')
-bin_script = os.path.join(script_dir, 'meson.py')
-gui_script = os.path.join(script_dir, 'mesongui.py')
-conf_script = os.path.join(script_dir, 'mesonconf.py')
-intro_script = os.path.join(script_dir, 'mesonintrospect.py')
-wraptool_script = os.path.join(script_dir, 'wraptool.py')
-bin_name = os.path.join(bin_dir, 'meson')
-gui_name = os.path.join(bin_dir, 'mesongui')
-conf_name = os.path.join(bin_dir, 'mesonconf')
-intro_name = os.path.join(bin_dir, 'mesonintrospect')
-wraptool_name = os.path.join(bin_dir, 'wraptool')
-man_dir = os.path.join(install_root, 'share/man/man1')
-in_manfile = 'man/meson.1'
-out_manfile = os.path.join(man_dir, 'meson.1.gz')
-in_guimanfile = 'man/mesongui.1'
-out_guimanfile = os.path.join(man_dir, 'mesongui.1.gz')
-in_confmanfile = 'man/mesonconf.1'
-out_confmanfile = os.path.join(man_dir, 'mesonconf.1.gz')
-in_intromanfile = 'man/mesonintrospect.1'
-out_intromanfile = os.path.join(man_dir, 'mesonintrospect.1.gz')
-in_wrapmanfile = 'man/wraptool.1'
-out_wrapmanfile = os.path.join(man_dir, 'wraptool.1.gz')
-rpmmacros_dir = os.path.join(install_root, 'lib/rpm/macros.d')
-
-symlink_value = os.path.relpath(bin_script, os.path.dirname(bin_name))
-guisymlink_value = os.path.relpath(gui_script, os.path.dirname(gui_name))
-confsymlink_value = os.path.relpath(conf_script, os.path.dirname(conf_name))
-introsymlink_value = os.path.relpath(intro_script, os.path.dirname(intro_name))
-wrapsymlink_value = os.path.relpath(wraptool_script, os.path.dirname(wraptool_name))
-
-files = glob.glob('*.py')
-files += glob.glob('*.ui')
-
-noinstall = ['compile_meson.py', 'install_meson.py', 'run_tests.py', 'run_cross_test.py']
-
-files = [x for x in files if x not in noinstall]
-
-os.makedirs(script_dir, exist_ok=True)
-os.makedirs(bin_dir, exist_ok=True)
-os.makedirs(man_dir, exist_ok=True)
-
-for f in files:
- print('Installing %s to %s.' %(f, script_dir))
- outfilename = os.path.join(script_dir, f)
- shutil.copyfile(f, outfilename)
- shutil.copystat(f, outfilename)
-
-print('Creating symlinks.')
-for i in [bin_name, gui_name, conf_name, intro_name, wraptool_name]:
- try:
- os.unlink(i)
- except FileNotFoundError:
- pass
-os.symlink(symlink_value, bin_name)
-os.symlink(guisymlink_value, gui_name)
-os.symlink(confsymlink_value, conf_name)
-os.symlink(introsymlink_value, intro_name)
-os.symlink(wrapsymlink_value, wraptool_name)
-print('Installing manfiles to %s.' % man_dir)
-open(out_manfile, 'wb').write(gzip.compress(open(in_manfile, 'rb').read()))
-open(out_confmanfile, 'wb').write(gzip.compress(open(in_confmanfile, 'rb').read()))
-open(out_guimanfile, 'wb').write(gzip.compress(open(in_guimanfile, 'rb').read()))
-open(out_intromanfile, 'wb').write(gzip.compress(open(in_intromanfile, 'rb').read()))
-open(out_wrapmanfile, 'wb').write(gzip.compress(open(in_wrapmanfile, 'rb').read()))
-
-print('Installing modules to %s.' % module_dir)
-if os.path.exists('modules/__pycache__'):
- shutil.rmtree('modules/__pycache__')
-if os.path.exists(module_dir):
- shutil.rmtree(module_dir)
-shutil.copytree('modules', module_dir)
-
-if os.path.exists('/usr/bin/rpm'):
- print('Installing RPM macros to %s.' % rpmmacros_dir)
- outfilename = os.path.join(rpmmacros_dir, 'macros.meson')
- os.makedirs(rpmmacros_dir, exist_ok=True)
- shutil.copyfile('data/macros.meson', outfilename)
- shutil.copystat('data/macros.meson', outfilename)
diff --git a/delwithsuffix.py b/meson
index 4b8a60d..b977368 100755
--- a/delwithsuffix.py
+++ b/meson
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2013 The Meson development team
+# 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.
@@ -14,19 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os, sys
+from mesonbuild import mesonmain
+import sys, os
-if len(sys.argv) != 3:
- print('%s <root of subdir to process> <suffix to delete>' % sys.argv[0])
- sys.exit(1)
+thisfile = __file__
+if not os.path.isabs(thisfile):
+ thisfile = os.path.normpath(os.path.join(os.getcwd(), thisfile))
-topdir = sys.argv[1]
-suffix = sys.argv[2]
-if suffix[0] != '.':
- suffix = '.' + suffix
-
-for (root, dirs, files) in os.walk(topdir):
- for f in files:
- if f.endswith(suffix):
- fullname = os.path.join(root, f)
- os.unlink(fullname)
+sys.exit(mesonmain.run(thisfile, sys.argv[1:]))
diff --git a/mesonbuild/__init__.py b/mesonbuild/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mesonbuild/__init__.py
diff --git a/backends.py b/mesonbuild/backends.py
index 748a742..c583a7b 100644
--- a/backends.py
+++ b/mesonbuild/backends.py
@@ -13,11 +13,26 @@
# limitations under the License.
import os, pickle, re
-import build
-import dependencies
-import mesonlib
+from . import build
+from . import dependencies
+from . import mesonlib
import json
-from coredata import MesonException
+from .coredata import MesonException
+
+class InstallData():
+ def __init__(self, source_dir, build_dir, prefix, depfixer):
+ self.source_dir = source_dir
+ self.build_dir= build_dir
+ self.prefix = prefix
+ self.targets = []
+ self.depfixer = depfixer
+ self.headers = []
+ self.man = []
+ self.data = []
+ self.po_package_name = ''
+ self.po = []
+ self.install_scripts = []
+ self.install_subdirs = []
class TestSerialisation:
def __init__(self, name, suite, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env,
diff --git a/build.py b/mesonbuild/build.py
index 7dededa..c0ba895 100644
--- a/build.py
+++ b/mesonbuild/build.py
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import coredata
-import environment
-import dependencies
-import mlog
+from . import coredata
+from . import environment
+from . import dependencies
+from . import mlog
import copy, os
-from mesonlib import File, flatten
+from .mesonlib import File, flatten
known_basic_kwargs = {'install' : True,
'c_pch' : True,
diff --git a/compilers.py b/mesonbuild/compilers.py
index 55b41dc..ec0181e 100644
--- a/compilers.py
+++ b/mesonbuild/compilers.py
@@ -14,10 +14,10 @@
import subprocess, os.path
import tempfile
-import mesonlib
-import mlog
-from coredata import MesonException
-import coredata
+from .import mesonlib
+from . import mlog
+from .coredata import MesonException
+from . import coredata
"""This file contains the data files of all compilers Meson knows
about. To support a new compiler, add its information below.
diff --git a/coredata.py b/mesonbuild/coredata.py
index 5b1102c..7f2254b 100644
--- a/coredata.py
+++ b/mesonbuild/coredata.py
@@ -14,7 +14,7 @@
import pickle, os, uuid
-version = '0.29.0-research'
+version = '0.29.0.dev2'
build_types = ['plain', 'debug', 'debugoptimized', 'release']
layouts = ['mirror', 'flat']
diff --git a/dependencies.py b/mesonbuild/dependencies.py
index cc9a941..974559f 100644
--- a/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -21,9 +21,9 @@
import re
import os, stat, glob, subprocess, shutil
-from coredata import MesonException
-import mlog
-import mesonlib
+from . coredata import MesonException
+from . import mlog
+from . import mesonlib
class DependencyException(MesonException):
def __init__(self, *args, **kwargs):
diff --git a/environment.py b/mesonbuild/environment.py
index e905b2f..8df856c 100644
--- a/environment.py
+++ b/mesonbuild/environment.py
@@ -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.
@@ -13,8 +13,8 @@
# limitations under the License.
import os, re, subprocess
-import coredata, mesonlib
-from compilers import *
+from . import coredata, mesonlib
+from .compilers import *
import configparser
build_filename = 'meson.build'
@@ -125,7 +125,7 @@ class Environment():
coredata.save(self.coredata, cdf)
def get_script_dir(self):
- return os.path.dirname(self.meson_script_file)
+ return os.path.join(os.path.dirname(self.meson_script_file), '../scripts')
def get_log_dir(self):
return self.log_dir
diff --git a/interpreter.py b/mesonbuild/interpreter.py
index 21cc6cf..4894ac7 100644
--- a/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mparser
-import environment
-import coredata
-import dependencies
-import mlog
-import build
-import optinterpreter
-import wrap
-import mesonlib
+from . import mparser
+from . import environment
+from . import coredata
+from . import dependencies
+from . import mlog
+from . import build
+from . import optinterpreter
+from .wrap import wrap
+from . import mesonlib
+
import os, sys, platform, subprocess, shutil, uuid, re
from functools import wraps
@@ -1093,7 +1094,7 @@ class Interpreter():
raise InvalidCode('Import takes one argument.')
modname = args[0]
if not modname in self.environment.coredata.modules:
- module = importlib.import_module('modules.' + modname).initialize()
+ module = importlib.import_module('mesonbuild.modules.' + modname).initialize()
self.environment.coredata.modules[modname] = module
return ModuleHolder(modname, self.environment.coredata.modules[modname], self)
@@ -1609,9 +1610,17 @@ class Interpreter():
regex_selector = vcs['rev_regex']
else:
vcs_cmd = [' '] # executing this cmd will fail in vcstagger.py and force to use the fallback string
- scriptfile = os.path.join(self.environment.get_script_dir(), 'vcstagger.py')
# vcstagger.py parameters: infile, outfile, fallback, source_dir, replace_string, regex_selector, command...
- kwargs['command'] = [sys.executable, scriptfile, '@INPUT0@', '@OUTPUT0@', fallback, source_dir, replace_string, regex_selector] + vcs_cmd
+ kwargs['command'] = [sys.executable,
+ self.environment.get_build_command(),
+ '--internal',
+ 'vcstagger',
+ '@INPUT0@',
+ '@OUTPUT0@',
+ fallback,
+ source_dir,
+ replace_string,
+ regex_selector] + vcs_cmd
kwargs.setdefault('build_always', True)
return self.func_custom_target(node, [kwargs['output']], kwargs)
diff --git a/mesonconf.py b/mesonbuild/mconf.py
index e53875f..f174425 100755..100644
--- a/mesonconf.py
+++ b/mesonbuild/mconf.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2014-2015 The Meson development team
+# Copyright 2014-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.
@@ -17,8 +17,8 @@
import sys, os
import pickle
import argparse
-import coredata, mesonlib
-from coredata import build_types, layouts, warning_levels, libtypelist
+from . import coredata, mesonlib
+from .coredata import build_types, warning_levels, libtypelist
parser = argparse.ArgumentParser()
@@ -59,13 +59,13 @@ class Conf:
longest_value = len(titles[2])
longest_possible_value = len(titles[3])
for x in arr:
- longest_name = max(longest_name, len(x[0]))
- longest_descr = max(longest_descr, len(x[1]))
- longest_value = max(longest_value, len(str(x[2])))
- longest_possible_value = max(longest_possible_value, len(x[3]))
+ longest_name = max(longest_name, len(x[0]))
+ longest_descr = max(longest_descr, len(x[1]))
+ longest_value = max(longest_value, len(str(x[2])))
+ longest_possible_value = max(longest_possible_value, len(x[3]))
if longest_possible_value > 0:
- titles[3] = 'Possible Values'
+ titles[3] = 'Possible Values'
print(' %s%s %s%s %s%s %s' % (titles[0], ' '*(longest_name - len(titles[0])), titles[1], ' '*(longest_descr - len(titles[1])), titles[2], ' '*(longest_value - len(titles[2])), titles[3]))
print(' %s%s %s%s %s%s %s' % ('-'*len(titles[0]), ' '*(longest_name - len(titles[0])), '-'*len(titles[1]), ' '*(longest_descr - len(titles[1])), '-'*len(titles[2]), ' '*(longest_value - len(titles[2])), '-'*len(titles[3])))
for i in arr:
@@ -179,15 +179,15 @@ class Conf:
optarr.append([key, opt.description, opt.value, choices])
self.print_aligned(optarr)
-if __name__ == '__main__':
- args = mesonlib.expand_arguments(sys.argv[:])
+def run(args):
+ args = mesonlib.expand_arguments(args)
if not args:
sys.exit(1)
- options = parser.parse_args(args[1:])
+ options = parser.parse_args(args)
if len(options.directory) > 1:
- print('%s <build directory>' % sys.argv[0])
+ print('%s <build directory>' % args[0])
print('If you omit the build directory, the current directory is substituted.')
- sys.exit(1)
+ return 1
if len(options.directory) == 0:
builddir = os.getcwd()
else:
@@ -202,4 +202,8 @@ if __name__ == '__main__':
except ConfException as e:
print('Meson configurator encountered an error:\n')
print(e)
+ return(1)
+ return 0
+if __name__ == '__main__':
+ sys.exit(run(sys.argv[1:]))
diff --git a/mesonlib.py b/mesonbuild/mesonlib.py
index 99d6154..a814567 100644
--- a/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -18,7 +18,7 @@ import platform, subprocess, operator, os, shutil, re, sys
from glob import glob
-from coredata import MesonException
+from .coredata import MesonException
class File:
def __init__(self, is_built, subdir, fname):
@@ -116,6 +116,15 @@ def detect_vcs(source_dir):
return vcs
return None
+def grab_leading_numbers(vstr):
+ result = []
+ for x in vstr.split('.'):
+ try:
+ result.append(int(x))
+ except ValueError:
+ break
+ return result
+
numpart = re.compile('[0-9.]+')
def version_compare(vstr1, vstr2):
@@ -146,8 +155,8 @@ def version_compare(vstr1, vstr2):
vstr2 = vstr2[1:]
else:
cmpop = operator.eq
- varr1 = [int(x) for x in vstr1.split('.')]
- varr2 = [int(x) for x in vstr2.split('.')]
+ varr1 = grab_leading_numbers(vstr1)
+ varr2 = grab_leading_numbers(vstr2)
return cmpop(varr1, varr2)
def default_libdir():
diff --git a/meson.py b/mesonbuild/mesonmain.py
index 0ba3447..6317c95 100755..100644
--- a/meson.py
+++ b/mesonbuild/mesonmain.py
@@ -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.
@@ -17,12 +17,12 @@
import sys, stat, traceback, pickle, argparse
import datetime
import os.path
-import environment, interpreter, mesonlib
-import build
+from . import environment, interpreter, mesonlib
+from . import build
import platform
-import mlog, coredata
+from . import mlog, coredata
-from coredata import MesonException, build_types, layouts, warning_levels, libtypelist
+from .coredata import MesonException, build_types, layouts, warning_levels, libtypelist
backendlist = ['ninja', 'vs2010', 'xcode']
@@ -138,13 +138,13 @@ itself as required.'''
mlog.log('Build type:', mlog.bold('native build'))
b = build.Build(env)
if self.options.backend == 'ninja':
- import ninjabackend
+ from . import ninjabackend
g = ninjabackend.NinjaBackend(b)
elif self.options.backend == 'vs2010':
- import vs2010backend
+ from . import vs2010backend
g = vs2010backend.Vs2010Backend(b)
elif self.options.backend == 'xcode':
- import xcodebackend
+ from . import xcodebackend
g = xcodebackend.XCodeBackend(b)
else:
raise RuntimeError('Unknown backend "%s".' % self.options.backend)
@@ -163,44 +163,83 @@ 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 mesonbuild.scripts.meson_test as abc
+ cmdfunc = abc.run
+ elif cmdname == 'benchmark':
+ import mesonbuild.scripts.meson_benchmark as abc
+ cmdfunc = abc.run
+ elif cmdname == 'install':
+ import mesonbuild.scripts.meson_install as abc
+ cmdfunc = abc.run
+ elif cmdname == 'commandrunner':
+ import mesonbuild.scripts.commandrunner as abc
+ cmdfunc = abc.run
+ elif cmdname == 'delsuffix':
+ import mesonbuild.scripts.delwithsuffix as abc
+ cmdfunc = abc.run
+ elif cmdname == 'depfixer':
+ import mesonbuild.scripts.depfixer as abc
+ cmdfunc = abc.run
+ elif cmdname == 'dirchanger':
+ import mesonbuild.scripts.dirchanger as abc
+ cmdfunc = abc.run
+ elif cmdname == 'gtkdoc':
+ import mesonbuild.scripts.gtkdochelper as abc
+ cmdfunc = abc.run
+ elif cmdname == 'regencheck':
+ import mesonbuild.scripts.regen_checker as abc
+ cmdfunc = abc.run
+ elif cmdname == 'symbolextractor':
+ import mesonbuild.scripts.symbolextractor as abc
+ cmdfunc = abc.run
+ elif cmdname == 'vcstagger':
+ import mesonbuild.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 len(args) >= 2 and args[0] == '--internal':
+ if args[1] != 'regenerate':
+ sys.exit(run_script_command(args[1:]))
+ args = args[2:]
handshake = True
else:
handshake = False
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
args = options.directories
if len(args) == 0 or len(args) > 2:
- print('%s <source directory> <build directory>' % sys.argv[0])
+ print('{} <source directory> <build directory>'.format(sys.argv[0]))
print('If you omit either directory, the current directory is substituted.')
+ print('Run {} --help for more information.'.format(sys.argv[0]))
return 1
dir1 = args[0]
if len(args) > 1:
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.
@@ -220,6 +259,3 @@ def run(args):
traceback.print_exc()
return 1
return 0
-
-if __name__ == '__main__':
- sys.exit(run(sys.argv[:]))
diff --git a/mesonmain.ui b/mesonbuild/mesonmain.ui
index 209584b..209584b 100644
--- a/mesonmain.ui
+++ b/mesonbuild/mesonmain.ui
diff --git a/mesonrunner.ui b/mesonbuild/mesonrunner.ui
index 942c6bd..942c6bd 100644
--- a/mesonrunner.ui
+++ b/mesonbuild/mesonrunner.ui
diff --git a/mesonstart.ui b/mesonbuild/mesonstart.ui
index c6c5f96..c6c5f96 100644
--- a/mesonstart.ui
+++ b/mesonbuild/mesonstart.ui
diff --git a/mesongui.py b/mesonbuild/mgui.py
index bdd44bb..6e57ce7 100755..100644
--- a/mesongui.py
+++ b/mesonbuild/mgui.py
@@ -15,7 +15,7 @@
# limitations under the License.
import sys, os, pickle, time, shutil
-import build, coredata, environment, mesonlib
+from . import build, coredata, environment, mesonlib
from PyQt5 import uic
from PyQt5.QtWidgets import QApplication, QMainWindow, QHeaderView
from PyQt5.QtWidgets import QComboBox, QCheckBox
@@ -242,23 +242,23 @@ class OptionForm:
combo.addItem('debug')
combo.addItem('debugoptimized')
combo.addItem('release')
- combo.setCurrentText(self.coredata.buildtype)
+ combo.setCurrentText(self.coredata.get_builtin_option('buildtype'))
combo.currentTextChanged.connect(self.build_type_changed)
self.form.addRow('Build type', combo)
strip = QCheckBox("")
- strip.setChecked(self.coredata.strip)
+ strip.setChecked(self.coredata.get_builtin_option('strip'))
strip.stateChanged.connect(self.strip_changed)
self.form.addRow('Strip on install', strip)
coverage = QCheckBox("")
- coverage.setChecked(self.coredata.coverage)
+ coverage.setChecked(self.coredata.get_builtin_option('coverage'))
coverage.stateChanged.connect(self.coverage_changed)
self.form.addRow('Enable coverage', coverage)
pch = QCheckBox("")
- pch.setChecked(self.coredata.use_pch)
+ pch.setChecked(self.coredata.get_builtin_option('use_pch'))
pch.stateChanged.connect(self.pch_changed)
self.form.addRow('Enable pch', pch)
unity = QCheckBox("")
- unity.setChecked(self.coredata.unity)
+ unity.setChecked(self.coredata.get_builtin_option('unity'))
unity.stateChanged.connect(self.unity_changed)
self.form.addRow('Unity build', unity)
form.addRow(PyQt5.QtWidgets.QLabel("Project options"))
@@ -545,17 +545,21 @@ class MesonGuiRespawner():
self.gui.resize(s)
# Garbage collection takes care of the old gui widget
-if __name__ == '__main__':
+
+def run(args): # SPECIAL, Qt wants all args, including command name.
app = QApplication(sys.argv)
- if len(sys.argv) == 1:
+ if len(args) == 1:
arg = ""
- elif len(sys.argv) == 2:
+ elif len(args) == 2:
arg = sys.argv[1]
else:
print(sys.argv[0], "<build or source dir>")
- sys.exit(1)
+ return 1
if os.path.exists(os.path.join(arg, 'meson-private/coredata.dat')):
guirespawner = MesonGuiRespawner(arg)
else:
runner = Starter(arg)
- sys.exit(app.exec_())
+ return app.exec_()
+
+if __name__ == '__main__':
+ sys.exit(run(sys.argv))
diff --git a/mesonintrospect.py b/mesonbuild/mintro.py
index 9fcd4db..b088117 100755..100644
--- a/mesonintrospect.py
+++ b/mesonbuild/mintro.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2014-2015 The Meson development team
+# Copyright 2014-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.
@@ -22,7 +22,7 @@ Currently only works for the Ninja backend. Others use generated
project files and don't need this info."""
import json, pickle
-import coredata, build, mesonlib
+from . import coredata, build, mesonlib
import argparse
import sys, os
@@ -172,11 +172,11 @@ def list_tests(testdata):
result.append(to)
print(json.dumps(result))
-if __name__ == '__main__':
- options = parser.parse_args()
+def run(args):
+ options = parser.parse_args(args)
if len(options.args) > 1:
print('Too many arguments')
- sys.exit(1)
+ return 1
elif len(options.args) == 1:
bdir = options.args[0]
else:
@@ -205,4 +205,8 @@ if __name__ == '__main__':
list_deps(coredata)
else:
print('No command specified')
- sys.exit(1)
+ return 1
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(run(sys.argv[1:]))
diff --git a/mlog.py b/mesonbuild/mlog.py
index 2807c2b..2807c2b 100644
--- a/mlog.py
+++ b/mesonbuild/mlog.py
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mesonbuild/modules/__init__.py
diff --git a/modules/gnome.py b/mesonbuild/modules/gnome.py
index 60c994e..a351694 100644
--- a/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -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.
@@ -15,13 +15,13 @@
'''This module provides helper functions for Gnome/GLib related
functionality such as gobject-introspection and gresources.'''
-import build
+from .. import build
import os, sys
import subprocess
-from coredata import MesonException
-import mlog
+from ..coredata import MesonException
+from .. import mlog
import xml.etree.ElementTree as ET
-from mesonlib import File
+from ..mesonlib import File
girwarning_printed = False
@@ -260,11 +260,11 @@ class GnomeModule:
main_file = main_xml
src_dir = kwargs['src_dir']
targetname = modulename + '-doc'
- command = os.path.normpath(os.path.join(os.path.split(__file__)[0], "../gtkdochelper.py"))
+ command = [state.environment.get_build_command(), '--internal', 'gtkdoc']
if hasattr(src_dir, 'held_object'):
src_dir= src_dir.held_object
if not isinstance(src_dir, build.IncludeDirs):
- raise MesonException('Invalidt keyword argument for src_dir.')
+ raise MesonException('Invalid keyword argument for src_dir.')
incdirs = src_dir.get_incdirs()
if len(incdirs) != 1:
raise MesonException('Argument src_dir has more than one directory specified.')
@@ -279,9 +279,9 @@ class GnomeModule:
'--modulename=' + modulename]
args += self.unpack_args('--htmlargs=', 'html_args', kwargs)
args += self.unpack_args('--scanargs=', 'scan_args', kwargs)
- res = [build.RunTarget(targetname, command, args, state.subdir)]
+ res = [build.RunTarget(targetname, command[0], command[1:] + args, state.subdir)]
if kwargs.get('install', True):
- res.append(build.InstallScript([command] + args))
+ res.append(build.InstallScript(command + args))
return res
def unpack_args(self, arg, kwarg_name, kwargs):
diff --git a/modules/modtest.py b/mesonbuild/modules/modtest.py
index c9247e6..c9247e6 100644
--- a/modules/modtest.py
+++ b/mesonbuild/modules/modtest.py
diff --git a/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 5fa4bd0..f18decf 100644
--- a/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import coredata, build
-import mesonlib
+from .. import coredata, build
+from .. import mesonlib
import os
class PkgConfigModule:
diff --git a/modules/qt4.py b/mesonbuild/modules/qt4.py
index bcf42a3..162b553 100644
--- a/modules/qt4.py
+++ b/mesonbuild/modules/qt4.py
@@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import dependencies, mlog
+from .. import dependencies, mlog
import os, subprocess
-import build
-from coredata import MesonException
+from .. import build
+from ..coredata import MesonException
import xml.etree.ElementTree as ET
class Qt4Module():
diff --git a/modules/qt5.py b/mesonbuild/modules/qt5.py
index 0e732a1..81edc76 100644
--- a/modules/qt5.py
+++ b/mesonbuild/modules/qt5.py
@@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import dependencies, mlog
+from .. import dependencies, mlog
import os, subprocess
-import build
-from coredata import MesonException
+from .. import build
+from ..coredata import MesonException
import xml.etree.ElementTree as ET
class Qt5Module():
diff --git a/modules/rpm.py b/mesonbuild/modules/rpm.py
index eebecdd..c8035ec 100644
--- a/modules/rpm.py
+++ b/mesonbuild/modules/rpm.py
@@ -15,11 +15,12 @@
'''This module provides helper functions for RPM related
functionality such as generating template RPM spec file.'''
-import build
-import compilers
+from .. import build
+from .. import compilers
import datetime
-import mlog
-import modules.gnome
+from .. import mlog
+from ..modules import gnome
+
import os
class RPMModule:
diff --git a/modules/windows.py b/mesonbuild/modules/windows.py
index e01b454..a785250 100644
--- a/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mesonlib, dependencies, build
-from coredata import MesonException
+from .. import mesonlib, dependencies, build
+from ..coredata import MesonException
import os
class WindowsModule:
diff --git a/mparser.py b/mesonbuild/mparser.py
index 455182a..1d569d5 100644
--- a/mparser.py
+++ b/mesonbuild/mparser.py
@@ -13,7 +13,7 @@
# limitations under the License.
import re
-from coredata import MesonException
+from .coredata import MesonException
class ParseException(MesonException):
def __init__(self, text, lineno, colno):
diff --git a/ninjabackend.py b/mesonbuild/ninjabackend.py
index fe0d4c9..1e220f8 100644
--- a/ninjabackend.py
+++ b/mesonbuild/ninjabackend.py
@@ -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.
@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import backends
-import environment, mesonlib
-import build
-import mlog
-import dependencies
-from mesonlib import File
-from meson_install import InstallData
-from build import InvalidArguments
-from coredata import MesonException
+from . import backends
+from . import environment, mesonlib
+from . import build
+from . import mlog
+from . import dependencies
+from .mesonlib import File
+from .backends import InstallData
+from .build import InvalidArguments
+from .coredata import MesonException
import os, sys, pickle, re
import subprocess, shutil
@@ -365,7 +365,7 @@ int dummy;
self.processed_targets[target.name + target.type_suffix()] = True
def generate_run_target(self, target, outfile):
- runnerscript = os.path.join(self.environment.get_script_dir(), 'commandrunner.py')
+ runnerscript = [sys.executable, self.environment.get_build_command(), '--internal', 'commandrunner']
deps = []
arg_strings = []
for i in target.args:
@@ -379,7 +379,7 @@ int dummy;
mlog.debug(str(i))
raise MesonException('Unreachable code in generate_run_target.')
elem = NinjaBuildElement(target.name, 'CUSTOM_COMMAND', deps)
- cmd = [sys.executable, runnerscript, self.environment.get_source_dir(), self.environment.get_build_dir(), target.subdir]
+ cmd = runnerscript + [self.environment.get_source_dir(), self.environment.get_build_dir(), target.subdir]
texe = target.command
try:
texe = texe.held_object
@@ -460,14 +460,14 @@ int dummy;
script_root = self.environment.get_script_dir()
install_script = os.path.join(script_root, 'meson_install.py')
install_data_file = os.path.join(self.environment.get_scratch_dir(), 'install.dat')
- depfixer = os.path.join(script_root, 'depfixer.py')
+ depfixer = [sys.executable, self.environment.get_build_command(), '--internal', 'depfixer']
d = InstallData(self.environment.get_source_dir(),
self.environment.get_build_dir(),
self.environment.get_prefix(), depfixer)
elem = NinjaBuildElement('install', 'CUSTOM_COMMAND', 'PHONY')
elem.add_dep('all')
elem.add_item('DESC', 'Installing files.')
- elem.add_item('COMMAND', [sys.executable, install_script, install_data_file])
+ elem.add_item('COMMAND', [sys.executable, self.environment.get_build_command(), '--internal', 'install', install_data_file])
elem.add_item('pool', 'console')
self.generate_depmf_install(d)
self.generate_target_install(d)
@@ -585,9 +585,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.')
@@ -607,7 +606,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.')
@@ -631,9 +630,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:
@@ -1096,9 +1097,12 @@ int dummy;
scriptdir = self.environment.get_script_dir()
outfile.write('\n')
symrule = 'rule SHSYM\n'
- symcmd = ' command = "%s" "%s" %s %s $CROSS\n' % (ninja_quote(sys.executable),
- ninja_quote(os.path.join(scriptdir, 'symbolextractor.py')),
- '$in', '$out')
+ symcmd = ' command = "%s" "%s" %s %s %s %s $CROSS\n' % (ninja_quote(sys.executable),
+ self.environment.get_build_command(),
+ '--internal',
+ 'symbolextractor',
+ '$in',
+ '$out')
synstat = ' restat = 1\n'
syndesc = ' description = Generating symbol file $out.\n'
outfile.write(symrule)
diff --git a/optinterpreter.py b/mesonbuild/optinterpreter.py
index 672df51..f0c93ae 100644
--- a/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mparser
-import coredata, mesonlib
+from . import mparser
+from . import coredata, mesonlib
import os, re
forbidden_option_names = coredata.builtin_options
diff --git a/mesonbuild/scripts/__init__.py b/mesonbuild/scripts/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mesonbuild/scripts/__init__.py
diff --git a/commandrunner.py b/mesonbuild/scripts/commandrunner.py
index 0dad585..1c37f5c 100755..100644
--- a/commandrunner.py
+++ b/mesonbuild/scripts/commandrunner.py
@@ -42,14 +42,18 @@ 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]')
- src_dir = sys.argv[1]
- build_dir = sys.argv[2]
- subdir = sys.argv[3]
- command = sys.argv[4]
- arguments = sys.argv[5:]
+def run(args):
+ if len(args) < 4:
+ print('commandrunner.py <source dir> <build dir> <subdir> <command> [arguments]')
+ return 1
+ src_dir = args[0]
+ build_dir = args[1]
+ subdir = args[2]
+ command = args[3]
+ arguments = args[4:]
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:]))
diff --git a/mesonbuild/scripts/delwithsuffix.py b/mesonbuild/scripts/delwithsuffix.py
new file mode 100644
index 0000000..38ab406
--- /dev/null
+++ b/mesonbuild/scripts/delwithsuffix.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+# Copyright 2013 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.
+
+import os, sys
+
+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]
+ suffix = sys.argv[2]
+ if suffix[0] != '.':
+ suffix = '.' + suffix
+
+ 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:])
diff --git a/depfixer.py b/mesonbuild/scripts/depfixer.py
index 4f7ce3d..1ab83b6 100755..100644
--- a/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -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:])
diff --git a/dirchanger.py b/mesonbuild/scripts/dirchanger.py
index fd3dc23..93a901d 100755..100644
--- a/dirchanger.py
+++ b/mesonbuild/scripts/dirchanger.py
@@ -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))
+ os.chdir(dirname)
+ return subprocess.call(command)
+
+if __name__ == '__main__':
+ sys.exit(run(sys.argv[1:]))
diff --git a/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
index 7e476b8..68be8f2 100755..100644
--- a/gtkdochelper.py
+++ b/mesonbuild/scripts/gtkdochelper.py
@@ -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:]))
diff --git a/meson_benchmark.py b/mesonbuild/scripts/meson_benchmark.py
index 4888d9f..26f1f95 100755..100644
--- a/meson_benchmark.py
+++ b/mesonbuild/scripts/meson_benchmark.py
@@ -16,7 +16,7 @@
import subprocess, sys, os, argparse
import pickle, statistics, json
-import meson_test
+from . import meson_test
parser = argparse.ArgumentParser()
parser.add_argument('--wd', default=None, dest='wd',
diff --git a/meson_install.py b/mesonbuild/scripts/meson_install.py
index c5c17ba..1ede757 100755..100644
--- a/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -17,21 +17,6 @@
import sys, pickle, os, shutil, subprocess, gzip, platform
from glob import glob
-class InstallData():
- def __init__(self, source_dir, build_dir, prefix, depfixer):
- self.source_dir = source_dir
- self.build_dir= build_dir
- self.prefix = prefix
- self.targets = []
- self.depfixer = depfixer
- self.headers = []
- self.man = []
- self.data = []
- self.po_package_name = ''
- self.po = []
- self.install_scripts = []
- self.install_subdirs = []
-
def do_install(datafilename):
ifile = open(datafilename, 'rb')
d = pickle.load(ifile)
@@ -208,7 +193,7 @@ def install_targets(d):
print("Symlink creation does not work on this platform.")
printed_symlink_error = True
if is_elf_platform():
- p = subprocess.Popen([d.depfixer, outname, install_rpath],
+ p = subprocess.Popen(d.depfixer + [outname, install_rpath],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(stdo, stde) = p.communicate()
@@ -218,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:]))
diff --git a/meson_test.py b/mesonbuild/scripts/meson_test.py
index 7758e5a..03fd073 100755..100644
--- a/meson_test.py
+++ b/mesonbuild/scripts/meson_test.py
@@ -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.
@@ -14,10 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import mesonbuild
import sys, os, subprocess, time, datetime, pickle, multiprocessing, json
import concurrent.futures as conc
import argparse
-import mesonlib
+import platform
+
+def is_windows():
+ platname = platform.system().lower()
+ return platname == 'windows' or 'mingw' in platname
tests_failed = []
@@ -70,7 +75,7 @@ def write_json_log(jsonlogfile, test_name, result):
jsonlogfile.write(json.dumps(result) + '\n')
def run_with_mono(fname):
- if fname.endswith('.exe') and not mesonlib.is_windows():
+ if fname.endswith('.exe') and not is_windows():
return True
return False
diff --git a/regen_checker.py b/mesonbuild/scripts/regen_checker.py
index a0fe028..f360a7c 100755..100644
--- a/regen_checker.py
+++ b/mesonbuild/scripts/regen_checker.py
@@ -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:])
diff --git a/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py
index f2c709d..79c1264 100755..100644
--- a/symbolextractor.py
+++ b/mesonbuild/scripts/symbolextractor.py
@@ -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.
@@ -23,7 +23,7 @@
# http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c
import sys, subprocess
-import mesonlib
+from mesonbuild import mesonlib
import argparse
parser = argparse.ArgumentParser()
@@ -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:]))
diff --git a/vcstagger.py b/mesonbuild/scripts/vcstagger.py
index ccc584e..390e37a 100755..100644
--- a/vcstagger.py
+++ b/mesonbuild/scripts/vcstagger.py
@@ -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:]))
diff --git a/vs2010backend.py b/mesonbuild/vs2010backend.py
index 76e024c..33e9646 100644
--- a/vs2010backend.py
+++ b/mesonbuild/vs2010backend.py
@@ -14,12 +14,12 @@
import os, sys
import pickle
-import backends, build
-import dependencies
-import mlog
+from . import backends, build
+from . import dependencies
+from . import mlog
import xml.etree.ElementTree as ET
import xml.dom.minidom
-from coredata import MesonException
+from .coredata import MesonException
class RegenInfo():
def __init__(self, source_dir, build_dir, depfiles, solutionfile):
diff --git a/mesonbuild/wrap/__init__.py b/mesonbuild/wrap/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mesonbuild/wrap/__init__.py
diff --git a/wrap.py b/mesonbuild/wrap/wrap.py
index ac1505f..2818fa0 100644
--- a/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -12,12 +12,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mlog
+from .. import mlog
import urllib.request, os, hashlib, shutil
import subprocess
import sys
-import wraptool
+try:
+ import ssl
+ has_ssl = True
+ API_ROOT = 'https://wrapdb.mesonbuild.com/v1/'
+except ImportError:
+ has_ssl = False
+ API_ROOT = 'http://wrapdb.mesonbuild.com/v1/'
+
+def build_ssl_context():
+ ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ ctx.options |= ssl.OP_NO_SSLv2
+ ctx.options |= ssl.OP_NO_SSLv3
+ ctx.verify_mode = ssl.CERT_REQUIRED
+ ctx.load_default_certs()
+ return ctx
+
+def open_wrapdburl(urlstring):
+ global ssl_warning_printed
+ if has_ssl:
+ try:
+ return urllib.request.urlopen(urlstring)#, context=build_ssl_context())
+ except urllib.error.URLError:
+ if not ssl_warning_printed:
+ print('SSL connection failed. Falling back to unencrypted connections.')
+ ssl_warning_printed = True
+ if not ssl_warning_printed:
+ print('Warning: SSL not available, traffic not authenticated.',
+ file=sys.stderr)
+ ssl_warning_printed = True
+ # Trying to open SSL connection to wrapdb fails because the
+ # certificate is not known.
+ if urlstring.startswith('https'):
+ urlstring = 'http' + urlstring[5:]
+ return urllib.request.urlopen(urlstring)
+
class PackageDefinition:
def __init__(self, fname):
@@ -94,7 +128,7 @@ class Resolver:
def get_data(self, url):
blocksize = 10*1024
if url.startswith('https://wrapdb.mesonbuild.com'):
- resp = wraptool.open_wrapdburl(url)
+ resp = open_wrapdburl(url)
else:
resp = urllib.request.urlopen(url)
dlsize = int(resp.info()['Content-Length'])
diff --git a/wraptool.py b/mesonbuild/wrap/wraptool.py
index 2366b78..c5f8eef 100755
--- a/wraptool.py
+++ b/mesonbuild/wrap/wraptool.py
@@ -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.
@@ -14,24 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import urllib.request, json
+import json
import sys, os
import configparser
import shutil
-import platform
-try:
- import ssl
- has_ssl = True
- API_ROOT = 'https://wrapdb.mesonbuild.com/v1/'
-except ImportError:
- has_ssl = False
- API_ROOT = 'http://wrapdb.mesonbuild.com/v1/'
-
-
-ssl_warning_printed = False
from glob import glob
+from .wrap import API_ROOT, open_wrapdburl
+
help_templ = '''This program allows you to manage your Wrap dependencies
using the online wrap database http://wrapdb.mesonbuild.com.
@@ -56,33 +47,6 @@ Commands:
def print_help():
print(help_templ % sys.argv[0])
-def build_ssl_context():
- ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- ctx.options |= ssl.OP_NO_SSLv2
- ctx.options |= ssl.OP_NO_SSLv3
- ctx.verify_mode = ssl.CERT_REQUIRED
- ctx.load_default_certs()
- return ctx
-
-def open_wrapdburl(urlstring):
- global ssl_warning_printed
- if has_ssl:
- try:
- return urllib.request.urlopen(urlstring)#, context=build_ssl_context())
- except urllib.error.URLError:
- if not ssl_warning_printed:
- print('SSL connection failed. Falling back to unencrypted connections.')
- ssl_warning_printed = True
- if not ssl_warning_printed:
- print('Warning: SSL not available, traffic not authenticated.',
- file=sys.stderr)
- ssl_warning_printed = True
- # Trying to open SSL connection to wrapdb fails because the
- # certificate is not known.
- if urlstring.startswith('https'):
- urlstring = 'http' + urlstring[5:]
- return urllib.request.urlopen(urlstring)
-
def get_result(urlstring):
u = open_wrapdburl(urlstring)
data = u.read().decode('utf-8')
@@ -197,37 +161,40 @@ def status():
else:
print('', name, 'not up to date. Have %s %d, but %s %d is available.' % (current_branch, current_revision, latest_branch, latest_revision))
-if __name__ == '__main__':
- if len(sys.argv) < 2 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
+def run(args):
+ if len(args) == 0 or args[0] == '-h' or args[0] == '--help':
print_help()
- sys.exit(0)
- command = sys.argv[1]
- args = sys.argv[2:]
+ return 0
+ command = args[0]
+ args = args[1:]
if command == 'list':
list_projects()
elif command == 'search':
if len(args) != 1:
print('Search requires exactly one argument.')
- sys.exit(1)
+ return 1
search(args[0])
elif command == 'install':
if len(args) != 1:
print('Install requires exactly one argument.')
- sys.exit(1)
+ return 1
install(args[0])
elif command == 'update':
if len(args) != 1:
print('update requires exactly one argument.')
- sys.exit(1)
+ return 1
update(args[0])
elif command == 'info':
if len(args) != 1:
print('info requires exactly one argument.')
- sys.exit(1)
+ return 1
info(args[0])
elif command == 'status':
status()
else:
print('Unknown command', command)
- sys.exit(1)
+ return 1
+ return 0
+if __name__ == '__main__':
+ sys.exit(run(sys.argv[1:]))
diff --git a/xcodebackend.py b/mesonbuild/xcodebackend.py
index d72cbdf..8ac3f67 100644
--- a/xcodebackend.py
+++ b/mesonbuild/xcodebackend.py
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import backends, build
-import mesonlib
+from . import backends, build
+from . import mesonlib
import uuid, os, sys
-from coredata import MesonException
+from .coredata import MesonException
class XCodeBackend(backends.Backend):
def __init__(self, build):
diff --git a/mesonconf b/mesonconf
new file mode 100755
index 0000000..2b0a1a6
--- /dev/null
+++ b/mesonconf
@@ -0,0 +1,20 @@
+#!/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 mesonbuild import mconf
+import sys
+
+sys.exit(mconf.run(sys.argv[1:]))
diff --git a/mesongui b/mesongui
new file mode 100755
index 0000000..9e16b00
--- /dev/null
+++ b/mesongui
@@ -0,0 +1,20 @@
+#!/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 mesonbuild import mgui
+import sys
+
+sys.exit(mgui.run(sys.argv))
diff --git a/mesonintrospect b/mesonintrospect
new file mode 100755
index 0000000..4d20548
--- /dev/null
+++ b/mesonintrospect
@@ -0,0 +1,20 @@
+#!/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 mesonbuild import mintro
+import sys
+
+sys.exit(mintro.run(sys.argv[1:]))
diff --git a/readme.txt b/readme.txt
index 2ecc346..4ed822f 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,22 +4,15 @@ build system.
Dependencies
-Python http://python.org (version 3.3 or newer)
+Python http://python.org (version 3.4 or newer)
Ninja http://martine.github.com/ninja/
Installing from source
You can run Meson directly from a revision control checkout or an
-extracted tarball. Installing it system-wide is simple.
-
-Configure step: None
-Compile step: None
-Unit test step: ./run_tests.py
-Install step: [sudo] ./install_meson.py --prefix /your/prefix --destdir /destdir/path
-
-The default value of prefix is /usr/local. The default value of destdir
-is empty.
+extracted tarball. Meson is also available from PyPi, so it can
+be installed with 'pip install meson'.
Running
diff --git a/run_cross_test.py b/run_cross_test.py
index 7355c28..a788850 100755
--- a/run_cross_test.py
+++ b/run_cross_test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2013-2014 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.
@@ -23,7 +23,7 @@ Not part of the main test suite because of two reasons:
Eventually migrate to something fancier.'''
import os, subprocess, shutil, sys
-import environment
+import mesonbuild.environment as environment
from run_tests import gather_tests
diff --git a/run_tests.py b/run_tests.py
index f1ed1c7..2211949 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -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.
@@ -18,15 +18,16 @@ from glob import glob
import os, subprocess, shutil, sys, signal
from io import StringIO
import sys
-import environment
-import mesonlib
-import mlog
-import meson, meson_test, meson_benchmark
+from mesonbuild import environment
+from mesonbuild import mesonlib
+from mesonbuild import mlog
+from mesonbuild import mesonmain
+from mesonbuild.scripts import meson_test, meson_benchmark
import argparse
import xml.etree.ElementTree as ET
import time
-from meson import backendlist
+from mesonbuild.mesonmain import backendlist
class TestResult:
def __init__(self, msg, stdo, stde, conftime=0, buildtime=0, testtime=0):
@@ -44,7 +45,7 @@ print_debug = 'MESON_PRINT_TEST_OUTPUT' in os.environ
test_build_dir = 'work area'
install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir')
-meson_command = './meson.py'
+meson_command = os.path.join(os.getcwd(), 'meson')
class StopException(Exception):
def __init__(self):
@@ -154,7 +155,7 @@ def run_configure_inprocess(commandlist):
old_stderr = sys.stderr
sys.stderr = mystderr = StringIO()
try:
- returncode = meson.run(commandlist)
+ returncode = mesonmain.run(commandlist[0], commandlist[1:])
finally:
sys.stdout = old_stdout
sys.stderr = old_stderr
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..49607ee
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,60 @@
+#!/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.
+
+# We need to support Python installations that have nothing but the basic
+# Python installation. Use setuptools when possible and fall back to
+# plain distutils when setuptools is not available.
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+from mesonbuild.coredata import version
+
+setup(name='meson',
+ version=version,
+ description='A high performance build system',
+ author='Jussi Pakkanen',
+ author_email='jpakkane@gmail.com',
+ url='http://mesonbuild.com',
+ license=' Apache License, Version 2.0',
+ packages=['mesonbuild',
+ 'mesonbuild.modules',
+ 'mesonbuild.scripts',
+ 'mesonbuild.wrap'],
+ package_data={'mesonbuild': ['*.ui']},
+ scripts=['meson', 'mesonconf', 'mesongui', 'mesonintrospect', 'wraptool'],
+ data_files=[('share/man/man1', ['man/meson.1',
+ 'man/mesonconf.1',
+ 'man/mesongui.1',
+ 'man/mesonintrospect.1',
+ 'man/wraptool.1'])],
+ classifiers=['Development Status :: 5 - Production/Stable',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Natural Language :: English',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX :: BSD',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python :: 3 :: Only',
+ 'Topic :: Software Development :: Build Tools',
+ ],
+ long_description='''Meson is a cross-platform build system designed to be both as
+fast and as user friendly as possible. It supports many languages and compilers, including
+GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
+complete DSL.''')
diff --git a/wraptool b/wraptool
new file mode 100755
index 0000000..5e03efd
--- /dev/null
+++ b/wraptool
@@ -0,0 +1,20 @@
+#!/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 mesonbuild.wrap import wraptool
+import sys
+
+sys.exit(wraptool.run(sys.argv[1:]))