diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-01-16 17:07:43 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-01-16 17:07:43 +0200 |
| commit | 2ee27504a83dca9982c50459e46f1b39108dc278 (patch) | |
| tree | 87c3d0bcfe47085ce186a97d42526ac30d492e68 | |
| parent | ec44795f8ab3719c0d720a79efcc476d2499f259 (diff) | |
| download | meson-2ee27504a83dca9982c50459e46f1b39108dc278.tar.gz | |
Moved mesonconf implementation in the module.
| -rw-r--r-- | meson/mconf.py (renamed from mesonconf.py) | 30 | ||||
| -rwxr-xr-x | mesonconf | 20 |
2 files changed, 37 insertions, 13 deletions
diff --git a/mesonconf.py b/meson/mconf.py index e53875f13..f17442567 100644 --- a/mesonconf.py +++ b/meson/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/mesonconf b/mesonconf new file mode 100755 index 000000000..3b5b5e966 --- /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 meson import mconf +import sys + +sys.exit(mconf.run(sys.argv[1:])) |
