Skip to content

Commit

Permalink
fix: Temporary 'fix' for rust-lang#56650.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ckaran committed Aug 26, 2022
1 parent 8a13871 commit d553ea7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions x.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import os
import sys
import re
import logging

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

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

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

import bootstrap
bootstrap.main()

0 comments on commit d553ea7

Please sign in to comment.