build: only do the lower case symbol copy on case sensitive file systems (#24876)
This commit is contained in:
parent
5ed8afbdb6
commit
4f4c383ec5
1 changed files with 15 additions and 9 deletions
|
@ -5,6 +5,11 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
def is_fs_case_sensitive():
|
||||||
|
with tempfile.NamedTemporaryFile(prefix='TmP') as tmp_file:
|
||||||
|
return(not os.path.exists(tmp_file.name.lower()))
|
||||||
|
|
||||||
sys.path.append(
|
sys.path.append(
|
||||||
os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))
|
os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))
|
||||||
|
@ -50,15 +55,16 @@ def main():
|
||||||
|
|
||||||
# The symbol server needs lowercase paths, it will fail otherwise
|
# The symbol server needs lowercase paths, it will fail otherwise
|
||||||
# So lowercase all the file paths here
|
# So lowercase all the file paths here
|
||||||
for f in files:
|
if is_fs_case_sensitive():
|
||||||
lower_f = f.lower()
|
for f in files:
|
||||||
if lower_f != f:
|
lower_f = f.lower()
|
||||||
if os.path.exists(lower_f):
|
if lower_f != f:
|
||||||
shutil.rmtree(lower_f)
|
if os.path.exists(lower_f):
|
||||||
lower_dir = os.path.dirname(lower_f)
|
shutil.rmtree(lower_f)
|
||||||
if not os.path.exists(lower_dir):
|
lower_dir = os.path.dirname(lower_f)
|
||||||
os.makedirs(lower_dir)
|
if not os.path.exists(lower_dir):
|
||||||
shutil.copy2(f, lower_f)
|
os.makedirs(lower_dir)
|
||||||
|
shutil.copy2(f, lower_f)
|
||||||
files = [f.lower() for f in files]
|
files = [f.lower() for f in files]
|
||||||
for f in files:
|
for f in files:
|
||||||
assert os.path.exists(f)
|
assert os.path.exists(f)
|
||||||
|
|
Loading…
Reference in a new issue