From 068103c7654138ee164072eb5ae05859770f7f67 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Sat, 10 Oct 2009 11:00:12 +0000 Subject: [PATCH] Added 'lockfile' option to scons It uses a lockfile to prevent multiple instances of scons from being run in the same working copy at the same time. --- SConstruct | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 7d0851b4c6d..76a431b7a99 100755 --- a/SConstruct +++ b/SConstruct @@ -90,7 +90,8 @@ opts.AddVariables( BoolVariable('distcc', 'Use distcc', False), BoolVariable('ccache', "Use ccache", False), ('cxxtool', 'Set c++ compiler command if not using standard compiler.'), - BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False) + BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False), + BoolVariable("lockfile", "Create a lockfile to prevent multiple instances of scons from being run at the same time on this working copy.", False) ) # @@ -100,6 +101,13 @@ opts.AddVariables( sys.path.insert(0, "./scons") env = Environment(tools=["tar", "gettext", "install", "python_devel", "scanreplace"], options = opts, toolpath = ["scons"]) +if env["lockfile"]: + print "Creating lockfile" + lockfile = os.path.abspath("scons.lock") + open(lockfile, "wx").write(str(os.getpid())) + import atexit + atexit.register(os.remove, lockfile) + opts.Save('.scons-option-cache', env) env.SConsignFile("$build_dir/sconsign.dblite")