author Andreas Pehrson <>
Thu, 13 Feb 2014 17:27:19 +0100
changeset 169180 cac044190278c8135838008137f0353f54626cca
parent 128594 260999a5d63b383d04c070410417828db69196d6
permissions -rw-r--r--
Bug 959154 - Part 6: Move away from DeprecatedDirectUpdate and remove them. r=nical

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at

import errno
import os

dependencies = []
targets = []

def makeQuote(filename):
    return filename.replace(' ', '\\ ')  # enjoy!

def writeMakeDependOutput(filename):
    print "Creating makedepend file", filename
    dir = os.path.dirname(filename)
    if dir and not os.path.exists(dir):
        except OSError as error:
            if error.errno != errno.EEXIST:

    with open(filename, 'w') as f:
        if len(targets) > 0:
            f.write("%s:" % makeQuote(targets[0]))
            for filename in dependencies:
                f.write(' \\\n\t\t%s' % makeQuote(filename))
            for filename in targets[1:]:
                f.write('%s: %s\n' % (makeQuote(filename), makeQuote(targets[0])))
            for filename in dependencies:
                f.write('%s:\n' % filename)