Skip to content

Commit b0a9937

Browse files
committed
mklldeps.py: Write to file instead of print
It seems that msys automatically converts `\n` to `\r\n` on pipe redirection, which causes `make tidy` failure.
1 parent 1890290 commit b0a9937

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

mk/llvm.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ $(S)src/librustc/lib/llvmdeps.rs: \
5151
$(LLVM_CONFIGS) \
5252
$(S)src/etc/mklldeps.py
5353
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
54-
"$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
55-
> $@
54+
"$@" "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS)
5655

5756
$(foreach host,$(CFG_HOST), \
5857
$(eval $(call DEF_LLVM_RULES,$(host))))

src/etc/mklldeps.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import sys
55
import subprocess
66

7-
components = sys.argv[1].split(' ')
7+
f = open(sys.argv[1], 'wb')
88

9-
print """// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
9+
components = sys.argv[2].split(' ')
10+
11+
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1012
// file at the top-level directory of this distribution and at
1113
// http://rust-lang.org/COPYRIGHT.
1214
//
@@ -18,10 +20,10 @@
1820
1921
// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
2022
// take a look at src/etc/mklldeps.py if you're interested
21-
"""
23+
""")
2224

23-
for llconfig in sys.argv[2:]:
24-
print
25+
for llconfig in sys.argv[3:]:
26+
f.write("\n")
2527

2628
proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
2729
out, err = proc.communicate()
@@ -42,7 +44,7 @@
4244
"target_os = \"" + os + "\"",
4345
]
4446

45-
print "#[cfg(" + ', '.join(cfg) + ")]"
47+
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
4648

4749
args = [llconfig, '--libs']
4850
args.extend(components)
@@ -51,7 +53,7 @@
5153

5254
for lib in out.strip().split(' '):
5355
lib = lib[2:] # chop of the leading '-l'
54-
print "#[link(name = \"" + lib + "\", kind = \"static\")]"
56+
f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")
5557
if os == 'win32':
56-
print "#[link(name = \"imagehlp\")]"
57-
print "extern {}"
58+
f.write("#[link(name = \"imagehlp\")]\n")
59+
f.write("extern {}\n")

0 commit comments

Comments
 (0)