diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-01-14 16:24:07 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-01-23 21:01:34 +0200 |
commit | fa0382f1f9d5677c1cbfb2dcec45c6d68702a261 (patch) | |
tree | 5a2800fc2e5a68ef0ea7f524645af2cd2ea83c2e /mesonbuild/mconf.py | |
parent | 469a758c322bc161d9d0bab00cf213acf7b33df5 (diff) | |
download | meson-fa0382f1f9d5677c1cbfb2dcec45c6d68702a261.zip meson-fa0382f1f9d5677c1cbfb2dcec45c6d68702a261.tar.gz meson-fa0382f1f9d5677c1cbfb2dcec45c6d68702a261.tar.bz2 |
Add option to mesonconf to wipe cached data.
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r-- | mesonbuild/mconf.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index c921409..2ab5f92 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -22,6 +22,8 @@ parser = argparse.ArgumentParser() parser.add_argument('-D', action='append', default=[], dest='sets', help='Set an option to the given value.') parser.add_argument('directory', nargs='*') +parser.add_argument('--clearcache', action='store_true', default=False, + help='Clear cached state (e.g. found dependencies)') class ConfException(mesonlib.MesonException): def __init__(self, *args, **kwargs): @@ -42,13 +44,16 @@ class Conf: raise ConfException('Version mismatch (%s vs %s)' % (coredata.version, self.coredata.version)) + def clear_cache(self): + self.coredata.deps = {} + def save(self): # Only called if something has changed so overwrite unconditionally. with open(self.coredata_file, 'wb') as f: pickle.dump(self.coredata, f) # We don't write the build file because any changes to it - # are erased when Meson is executed the nex time, i.e. the next - # time Ninja is run. + # are erased when Meson is executed the next time, i.e. whne + # Ninja is run. def print_aligned(self, arr): if len(arr) == 0: @@ -223,11 +228,17 @@ def run(args): builddir = options.directory[0] try: c = Conf(builddir) + save = False if len(options.sets) > 0: c.set_options(options.sets) - c.save() + save = True + elif options.clearcache: + c.clear_cache() + save = True else: c.print_conf() + if save: + c.save() except ConfException as e: print('Meson configurator encountered an error:\n') print(e) |