mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 906240 - Adapt cl.py dependency output to pymake deficiencies ; also add source file to the list of dependencies. r=gps
This commit is contained in:
parent
e409d34070
commit
c72ba9fb38
21
build/cl.py
21
build/cl.py
@ -19,13 +19,17 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
if target == None:
|
if target == None:
|
||||||
print >>sys.stderr, "No target set" and sys.exit(1)
|
print >>sys.stderr, "No target set" and sys.exit(1)
|
||||||
|
|
||||||
|
# Assume the source file is the last argument
|
||||||
|
source = cmdline[-1]
|
||||||
|
assert not source.startswith('-')
|
||||||
|
|
||||||
# The deps target lives here
|
# The deps target lives here
|
||||||
depstarget = os.path.basename(target) + ".pp"
|
depstarget = os.path.basename(target) + ".pp"
|
||||||
|
|
||||||
cmdline += ['-showIncludes']
|
cmdline += ['-showIncludes']
|
||||||
cl = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
cl = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
deps = set()
|
deps = set([os.path.normcase(source).replace(os.sep, '/')])
|
||||||
for line in cl.stdout:
|
for line in cl.stdout:
|
||||||
# cl -showIncludes prefixes every header with "Note: including file:"
|
# cl -showIncludes prefixes every header with "Note: including file:"
|
||||||
# and an indentation corresponding to the depth (which we don't need)
|
# and an indentation corresponding to the depth (which we don't need)
|
||||||
@ -34,8 +38,8 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
# We can't handle pathes with spaces properly in mddepend.pl, but
|
# We can't handle pathes with spaces properly in mddepend.pl, but
|
||||||
# we can assume that anything in a path with spaces is a system
|
# we can assume that anything in a path with spaces is a system
|
||||||
# header and throw it away.
|
# header and throw it away.
|
||||||
if dep.find(' ') == -1:
|
if ' ' not in dep:
|
||||||
deps.add(dep)
|
deps.add(os.path.normcase(dep).replace(os.sep, '/'))
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(line) # Make sure we preserve the relevant output
|
sys.stdout.write(line) # Make sure we preserve the relevant output
|
||||||
# from cl
|
# from cl
|
||||||
@ -54,10 +58,13 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
# cost of masking failure to create the directory. We'll just
|
# cost of masking failure to create the directory. We'll just
|
||||||
# die on the next line though, so it's not that much of a loss.
|
# die on the next line though, so it's not that much of a loss.
|
||||||
|
|
||||||
f = open(depstarget, "w")
|
with open(depstarget, "w") as f:
|
||||||
for dep in sorted(deps):
|
f.write("%s: %s" % (target, source))
|
||||||
print >>f, "%s: %s" % (target, dep)
|
for dep in sorted(deps):
|
||||||
print >>f, "%s:" % dep
|
f.write(" \\\n%s" % dep)
|
||||||
|
f.write('\n')
|
||||||
|
for dep in sorted(deps):
|
||||||
|
f.write("%s:\n" % dep)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
InvokeClWithDependencyGeneration(sys.argv[1:])
|
InvokeClWithDependencyGeneration(sys.argv[1:])
|
||||||
|
@ -19,13 +19,17 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
if target == None:
|
if target == None:
|
||||||
print >>sys.stderr, "No target set" and sys.exit(1)
|
print >>sys.stderr, "No target set" and sys.exit(1)
|
||||||
|
|
||||||
|
# Assume the source file is the last argument
|
||||||
|
source = cmdline[-1]
|
||||||
|
assert not source.startswith('-')
|
||||||
|
|
||||||
# The deps target lives here
|
# The deps target lives here
|
||||||
depstarget = os.path.basename(target) + ".pp"
|
depstarget = os.path.basename(target) + ".pp"
|
||||||
|
|
||||||
cmdline += ['-showIncludes']
|
cmdline += ['-showIncludes']
|
||||||
cl = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
cl = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
deps = set()
|
deps = set([os.path.normcase(source).replace(os.sep, '/')])
|
||||||
for line in cl.stdout:
|
for line in cl.stdout:
|
||||||
# cl -showIncludes prefixes every header with "Note: including file:"
|
# cl -showIncludes prefixes every header with "Note: including file:"
|
||||||
# and an indentation corresponding to the depth (which we don't need)
|
# and an indentation corresponding to the depth (which we don't need)
|
||||||
@ -34,8 +38,8 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
# We can't handle pathes with spaces properly in mddepend.pl, but
|
# We can't handle pathes with spaces properly in mddepend.pl, but
|
||||||
# we can assume that anything in a path with spaces is a system
|
# we can assume that anything in a path with spaces is a system
|
||||||
# header and throw it away.
|
# header and throw it away.
|
||||||
if dep.find(' ') == -1:
|
if ' ' not in dep:
|
||||||
deps.add(dep)
|
deps.add(os.path.normcase(dep).replace(os.sep, '/'))
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(line) # Make sure we preserve the relevant output
|
sys.stdout.write(line) # Make sure we preserve the relevant output
|
||||||
# from cl
|
# from cl
|
||||||
@ -54,10 +58,13 @@ def InvokeClWithDependencyGeneration(cmdline):
|
|||||||
# cost of masking failure to create the directory. We'll just
|
# cost of masking failure to create the directory. We'll just
|
||||||
# die on the next line though, so it's not that much of a loss.
|
# die on the next line though, so it's not that much of a loss.
|
||||||
|
|
||||||
f = open(depstarget, "w")
|
with open(depstarget, "w") as f:
|
||||||
for dep in sorted(deps):
|
f.write("%s: %s" % (target, source))
|
||||||
print >>f, "%s: %s" % (target, dep)
|
for dep in sorted(deps):
|
||||||
print >>f, "%s:" % dep
|
f.write(" \\\n%s" % dep)
|
||||||
|
f.write('\n')
|
||||||
|
for dep in sorted(deps):
|
||||||
|
f.write("%s:\n" % dep)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
InvokeClWithDependencyGeneration(sys.argv[1:])
|
InvokeClWithDependencyGeneration(sys.argv[1:])
|
||||||
|
Loading…
Reference in New Issue
Block a user