in automation/symbols-generation/symbolstore.py [0:0]
def CopyDebug(self, file, debug_file, guid, code_file, code_id):
file = locate_pdb(file)
def compress(path):
compressed_file = path[:-1] + "_"
# ignore makecab's output
makecab = os.environ["MAKECAB"]
success = subprocess.call(
[makecab, "-D", "CompressionType=MSZIP", path, compressed_file],
stdout=open(os.devnull, "w"),
stderr=subprocess.STDOUT,
)
if success == 0 and os.path.exists(compressed_file):
os.unlink(path)
return True
return False
rel_path = os.path.join(debug_file, guid, debug_file).replace("\\", "/")
full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path))
shutil.copyfile(file, full_path)
if compress(full_path):
print(rel_path[:-1] + "_")
else:
print(rel_path)
# Copy the binary file as well
if code_file and code_id:
full_code_path = os.path.join(os.path.dirname(file), code_file)
if os.path.exists(full_code_path):
rel_path = os.path.join(code_file, code_id, code_file).replace(
"\\", "/"
)
full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path))
try:
os.makedirs(os.path.dirname(full_path))
except OSError as e:
if e.errno != errno.EEXIST:
raise
shutil.copyfile(full_code_path, full_path)
if compress(full_path):
print(rel_path[:-1] + "_")
else:
print(rel_path)