deploy.py: Support Python 2.7, do not require all clang executables

FileNotFoundException is new in Python 3.
We might not have a LLVM build with e.g. clazy-standalone and clang-tidy,
make deployment of Clang executables optional.

Change-Id: Id25b2f65a8d060bac9cb7a66fb2cd7022e2724e0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2020-12-09 14:12:20 +01:00
committed by Cristian Adam
parent 3b7aee724d
commit ca016bfb2e

View File

@@ -113,7 +113,7 @@ def is_debug(fpath):
try: try:
output = subprocess.check_output(['dumpbin', '/imports', fpath]) output = subprocess.check_output(['dumpbin', '/imports', fpath])
return coredebug.search(output.decode(encoding)) != None return coredebug.search(output.decode(encoding)) != None
except FileNotFoundError: except OSError:
# dumpbin is not there, maybe MinGW ? Just ship all .dlls. # dumpbin is not there, maybe MinGW ? Just ship all .dlls.
return debug_build return debug_build
@@ -238,16 +238,10 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
os.makedirs(clanglibdirtarget) os.makedirs(clanglibdirtarget)
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'), deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'),
os.path.join(install_dir, 'bin'))) os.path.join(install_dir, 'bin')))
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'), for binary in ['clang', 'clang-cl', 'clangd', 'clang-tidy', 'clazy-standalone']:
clangbindirtarget)) binary_filepath = os.path.join(llvm_install_dir, 'bin', 'clang.exe')
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'), if os.path.exists(binary_filepath):
clangbindirtarget)) deployinfo.append((binary_filepath, clangbindirtarget))
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clangd.exe'),
clangbindirtarget))
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-tidy.exe'),
clangbindirtarget))
deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clazy-standalone.exe'),
clangbindirtarget))
resourcetarget = os.path.join(clanglibdirtarget, 'clang') resourcetarget = os.path.join(clanglibdirtarget, 'clang')
else: else:
# libclang -> Qt Creator libraries # libclang -> Qt Creator libraries
@@ -260,12 +254,13 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
os.makedirs(clangbinary_targetdir) os.makedirs(clangbinary_targetdir)
for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']: for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']:
binary_filepath = os.path.join(llvm_install_dir, 'bin', binary) binary_filepath = os.path.join(llvm_install_dir, 'bin', binary)
deployinfo.append((binary_filepath, clangbinary_targetdir)) if os.path.exists(binary_filepath):
# add link target if binary is actually a symlink (to a binary in the same directory) deployinfo.append((binary_filepath, clangbinary_targetdir))
if os.path.islink(binary_filepath): # add link target if binary is actually a symlink (to a binary in the same directory)
linktarget = os.readlink(binary_filepath) if os.path.islink(binary_filepath):
deployinfo.append((os.path.join(os.path.dirname(binary_filepath), linktarget), linktarget = os.readlink(binary_filepath)
os.path.join(clangbinary_targetdir, linktarget))) deployinfo.append((os.path.join(os.path.dirname(binary_filepath), linktarget),
os.path.join(clangbinary_targetdir, linktarget)))
clanglibs_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib') clanglibs_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib')
# support libraries (for clazy) -> clang libexec # support libraries (for clazy) -> clang libexec
if not os.path.exists(clanglibs_targetdir): if not os.path.exists(clanglibs_targetdir):