Bug 852103 - Fix race condition with .deps directory creation. r=ted

This commit is contained in:
Mike Hommey
2013-03-19 06:29:48 +01:00
parent 06d7d77799
commit f430a00cd5

View File

@@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import errno
dependencies = []
targets = []
@@ -10,6 +12,14 @@ def makeQuote(filename):
def writeMakeDependOutput(filename):
print "Creating makedepend file", filename
dir = os.path.dirname(filename)
if dir and not os.path.exists(dir):
try:
os.makedirs(dir)
except OSError as error:
if error.errno != errno.EEXIST:
raise
with open(filename, 'w') as f:
if len(targets) > 0:
f.write("%s:" % makeQuote(targets[0]))