diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-02-05 11:18:57 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-02-05 11:18:57 +0100 |
commit | 71d174bcbe7ef6d319ee0afd1794073354e1bd35 (patch) | |
tree | b59396861767c4456007562ea92efa0fa167bd44 | |
parent | 90bc125d2952e281ec47c366b83f034f8a1f6993 (diff) | |
download | meson-71d174bcbe7ef6d319ee0afd1794073354e1bd35.zip meson-71d174bcbe7ef6d319ee0afd1794073354e1bd35.tar.gz meson-71d174bcbe7ef6d319ee0afd1794073354e1bd35.tar.bz2 |
Fixed some code issues
-rw-r--r-- | mesonbuild/mconf.py | 14 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index da51160..9f74eae 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -38,9 +38,9 @@ class ConfException(mesonlib.MesonException): class Conf: def __init__(self, build_dir): self.build_dir = os.path.abspath(os.path.realpath(build_dir)) - if self.build_dir.endswith('/meson.build') or self.build_dir.endswith('\\meson.build') or self.build_dir == 'meson.build': + if 'meson.build' in [os.path.basename(self.build_dir), self.build_dir]: self.build_dir = os.path.dirname(self.build_dir) - self.build: build.Build = None + self.build = None if os.path.isdir(os.path.join(self.build_dir, 'meson-private')): self.build = build.load(self.build_dir) @@ -184,17 +184,21 @@ def run(options): c = None try: c = Conf(builddir) + if c.default_values_only: + c.print_conf() + return 0 + save = False - if len(options.cmd_line_options) > 0 and not c.default_values_only: + if len(options.cmd_line_options) > 0: c.set_options(options.cmd_line_options) coredata.update_cmd_line_file(builddir, options) save = True - elif options.clearcache and not c.default_values_only: + elif options.clearcache: c.clear_cache() save = True else: c.print_conf() - if save and not c.default_values_only: + if save: c.save() mintro.update_build_options(c.coredata, c.build.environment.info_dir) mintro.write_meson_info_file(c.build, []) diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 36368af..4657b8c 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -441,7 +441,7 @@ def run(options): if options.builddir is not None: datadir = os.path.join(options.builddir, datadir) infodir = os.path.join(options.builddir, infodir) - if options.builddir.endswith('/meson.build') or options.builddir.endswith('\\meson.build') or options.builddir == 'meson.build': + if 'meson.build' in [os.path.basename(options.builddir), options.builddir]: sourcedir = '.' if options.builddir == 'meson.build' else options.builddir[:-11] if options.projectinfo: list_projinfo_from_source(sourcedir, indent) |