diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-07-07 00:24:19 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-07-15 13:47:17 +0200 |
commit | b52955ff3d3a73891c9250b0c6e3839593cd456b (patch) | |
tree | 953b6cfa6b0f80432dbc36c7df09d6ffd9fed9a5 /mesonbuild/mesonmain.py | |
parent | 09a5399d095137d3d302dc885abbf88731a1918b (diff) | |
download | meson-b52955ff3d3a73891c9250b0c6e3839593cd456b.zip meson-b52955ff3d3a73891c9250b0c6e3839593cd456b.tar.gz meson-b52955ff3d3a73891c9250b0c6e3839593cd456b.tar.bz2 |
Run postconf scripts after dumping coredata.
MESONINTROSPECT is set when running postconf scripts, which implies that
introspection is possible. But it isn't really possible because coredata
hasn't been written yet. We also still need to make sure to delete
coredata if any postconf scripts fail.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r-- | mesonbuild/mesonmain.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 603be18..0164945 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -180,20 +180,26 @@ If you want to change option values, use the mesonconf tool instead.''' intr.run() coredata_mtime = time.time() g.generate(intr) - g.run_postconf_scripts() dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat') with open(dumpfile, 'wb') as f: pickle.dump(b, f) - # Write this last since we use the existence of this file to check if - # we generated the build file successfully, so we don't want an error - # that pops up during generation, post-conf scripts, etc to cause us to + # Write this as late as possible since we use the existence of this + # file to check if we generated the build file successfully, so we + # don't want an error that pops up during generation, etc to cause us to # incorrectly signal a successful meson run which will cause an error # about an already-configured build directory when the user tries again. # # However, we set the mtime to an earlier value to ensure that doing an # mtime comparison between the coredata dump and other build files # shows the build files to be newer, not older. - env.dump_coredata(coredata_mtime) + cdf = env.dump_coredata(coredata_mtime) + # Post-conf scripts must be run after writing coredata or else introspection fails. + try: + g.run_postconf_scripts() + except: + os.unlink(cdf) + raise + def run_script_command(args): cmdname = args[0] |