Skip to content

Commit d553ea7

Browse files
committed
fix: Temporary 'fix' for rust-lang#56650.
The build system fails if there are spaces in the path leading to the rust repository. This is a quick fix that detects if there are any spaces in the path leading to the rust repository, and if there are, quits with a message warning the user about the problem. Signed-off-by: Cem Karan <[email protected]>
1 parent 8a13871 commit d553ea7

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Diff for: x.py

+20-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import os
88
import sys
9+
import re
10+
import logging
911

1012
# If this is python2, check if python3 is available and re-execute with that
1113
# interpreter. Only python3 allows downloading CI LLVM.
@@ -22,7 +24,22 @@
2224
pass
2325

2426
rust_dir = os.path.dirname(os.path.abspath(__file__))
25-
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
2627

27-
import bootstrap
28-
bootstrap.main()
28+
# Temporary 'fix' for https://github.com/rust-lang/rust/issues/56650.
29+
# Various chunks of the build system can't correctly handle spaces in paths, and
30+
# will break in unexpected ways if there are any. This tests to see if there
31+
# are spaces in the path, quitting with an error if there are any
32+
if re.search("\s", rust_dir):
33+
logging.critical("There is a known bug in the build system "
34+
"(https://github.com/rust-lang/rust/issues/56650) "
35+
"that means that if there are spaces in your path then "
36+
"the build system will fail. Your path ('%s') contains "
37+
"at least one space in it. Either move your rust "
38+
"repository to a path that has no spaces in it, or "
39+
"change your path to remove all spaces. Now quitting.",
40+
rust_dir)
41+
else:
42+
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
43+
44+
import bootstrap
45+
bootstrap.main()

0 commit comments

Comments
 (0)