Skip to content

Commit 91a8677

Browse files
committed
auto merge of #913 : jmesmon/cargo/forgive-wierd-triples, r=alexcrichton
2 parents f710146 + 2a3ea0b commit 91a8677

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

src/etc/dl-snapshot.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,45 @@
2525
win64 = lines[6]
2626
triple = sys.argv[1]
2727

28-
if triple == 'i686-unknown-linux-gnu':
29-
me = linux32
30-
elif triple == 'x86_64-unknown-linux-gnu':
31-
me = linux64
32-
elif triple == 'i686-apple-darwin':
33-
me = mac32
34-
elif triple == 'x86_64-apple-darwin':
35-
me = mac64
36-
elif triple == 'i686-pc-windows-gnu':
37-
me = win32
38-
elif triple == 'x86_64-pc-windows-gnu':
39-
me = win64
28+
ts = triple.split('-')
29+
arch = ts[0]
30+
if len(ts) == 2:
31+
vendor = 'unknown'
32+
target_os = ts[1]
4033
else:
34+
vendor = ts[1]
35+
target_os = ts[2]
36+
37+
intel32 = (arch == 'i686') or (arch == 'i586')
38+
39+
me = None
40+
if target_os == 'linux':
41+
if intel32:
42+
me = linux32
43+
new_triple = 'i686-unknown-linux-gnu'
44+
elif arch == 'x86_64':
45+
me = linux64
46+
new_triple = 'x86_64-unknown-linux-gnu'
47+
elif target_os == 'darwin':
48+
if intel32:
49+
me = mac32
50+
new_triple = 'i686-apple-darwin'
51+
elif arch == 'x86_64':
52+
me = mac64
53+
new_triple = 'x86_64-apple-darwin'
54+
elif target_os == 'windows':
55+
if intel32:
56+
me = win32
57+
new_triple = 'i686-pc-windows-gnu'
58+
elif arch == 'x86_64':
59+
me = win64
60+
new_triple = 'x86_64-pc-windows-gnu'
61+
62+
if me is None:
4163
raise Exception("no snapshot for the triple: " + triple)
4264

65+
triple = new_triple
66+
4367
platform, hash = me.strip().split()
4468

4569
tarball = 'cargo-nightly-' + triple + '.tar.gz'

0 commit comments

Comments
 (0)