From ca016bfb2e7a78253b1ad5dfc457583e8491be1a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 9 Dec 2020 14:12:20 +0100 Subject: 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 --- scripts/deployqt.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'scripts/deployqt.py') diff --git a/scripts/deployqt.py b/scripts/deployqt.py index 45bacd674e..4dc11b6cf5 100755 --- a/scripts/deployqt.py +++ b/scripts/deployqt.py @@ -113,7 +113,7 @@ def is_debug(fpath): try: output = subprocess.check_output(['dumpbin', '/imports', fpath]) return coredebug.search(output.decode(encoding)) != None - except FileNotFoundError: + except OSError: # dumpbin is not there, maybe MinGW ? Just ship all .dlls. return debug_build @@ -238,16 +238,10 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin): os.makedirs(clanglibdirtarget) deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'), os.path.join(install_dir, 'bin'))) - deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'), - clangbindirtarget)) - deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'), - 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)) + for binary in ['clang', 'clang-cl', 'clangd', 'clang-tidy', 'clazy-standalone']: + binary_filepath = os.path.join(llvm_install_dir, 'bin', 'clang.exe') + if os.path.exists(binary_filepath): + deployinfo.append((binary_filepath, clangbindirtarget)) resourcetarget = os.path.join(clanglibdirtarget, 'clang') else: # libclang -> Qt Creator libraries @@ -260,12 +254,13 @@ def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin): os.makedirs(clangbinary_targetdir) for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']: binary_filepath = os.path.join(llvm_install_dir, 'bin', binary) - deployinfo.append((binary_filepath, clangbinary_targetdir)) - # add link target if binary is actually a symlink (to a binary in the same directory) - if os.path.islink(binary_filepath): - linktarget = os.readlink(binary_filepath) - deployinfo.append((os.path.join(os.path.dirname(binary_filepath), linktarget), - os.path.join(clangbinary_targetdir, linktarget))) + if os.path.exists(binary_filepath): + deployinfo.append((binary_filepath, clangbinary_targetdir)) + # add link target if binary is actually a symlink (to a binary in the same directory) + if os.path.islink(binary_filepath): + linktarget = os.readlink(binary_filepath) + 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') # support libraries (for clazy) -> clang libexec if not os.path.exists(clanglibs_targetdir): -- cgit v1.2.1