diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-05-19 13:44:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-05-19 13:44:45 +0200 |
commit | 46963261d03f3123862eae7cbd94bcd463b28a9b (patch) | |
tree | ce84f473ddd9b77f7745fc4c9a5b8fec2507f64c | |
parent | 2f5785097e1138eb9b3c252d04bb6e50a4c19943 (diff) | |
parent | c5139fe6e350ccdb315e2b5dabccf31c04b8eed0 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: If6dc624a06b90a3e87a4d9e35903257e906bfb6e
-rw-r--r-- | build_history/blacklist.txt | 4 | ||||
-rw-r--r-- | popenasync.py | 6 | ||||
-rw-r--r-- | setup.py | 100 |
3 files changed, 87 insertions, 23 deletions
diff --git a/build_history/blacklist.txt b/build_history/blacklist.txt index af7a93729..4099cc094 100644 --- a/build_history/blacklist.txt +++ b/build_history/blacklist.txt @@ -43,6 +43,10 @@ linux darwin win32 +[QtQml::bug_951] + py3 +[QtQml::javascript_exceptions] + py3 [QtScript::qscriptvalue_test] linux darwin diff --git a/popenasync.py b/popenasync.py index cfd0e13ad..eedc2fd8b 100644 --- a/popenasync.py +++ b/popenasync.py @@ -68,10 +68,10 @@ if mswindows: if sys.version_info >= (3,): # Test date should be in ascii. def encode(s): - return s.encode('ascii') - + return s.encode('ascii', 'ignore') + def decode(b): - return b.decode('ascii') + return b.decode('ascii', 'ignore') else: # Strings only; do nothing def encode(s): @@ -38,6 +38,7 @@ ############################################################################# from __future__ import print_function +from distutils.version import LooseVersion """This is a distutils setup-script for the PySide2 project @@ -351,6 +352,22 @@ def prefix(): name += 'd' return name +def detectClang(): + source = 'LLVM_INSTALL_DIR' + clangDir = os.environ.get(source, None) + if not clangDir: + source = 'CLANG_INSTALL_DIR' + clangDir = os.environ.get(source, None) + if not clangDir: + source = 'llvm-config' + try: + output = run_process_output([source, '--prefix']) + if output: + clangDir = output[0] + except: + pass + return [clangDir, source] + # Initialize, pull and checkout submodules def prepareSubModules(): print("Initializing submodules for PySide2 version %s" % __version__) @@ -581,6 +598,8 @@ class pyside_build(_build): else: # Python 2 lib_suff = '' lib_exts.append('.so.1') + # Suffix for OpenSuSE 13.01 + lib_exts.append('.so.1.0') lib_exts.append('.a') # static library as last gasp if sys.version_info[0] == 2 and dbgPostfix: @@ -590,33 +609,55 @@ class pyside_build(_build): # be built with a non-debug Python. lib_exts = [dbgPostfix + e for e in lib_exts] + lib_exts + python_library_found = False libs_tried = [] for lib_ext in lib_exts: lib_name = "libpython%s%s%s" % (py_version, lib_suff, lib_ext) py_library = os.path.join(py_libdir, lib_name) if os.path.exists(py_library): + python_library_found = True break libs_tried.append(py_library) else: - py_multiarch = get_config_var("MULTIARCH") - if py_multiarch: - try_py_libdir = os.path.join(py_libdir, py_multiarch) - libs_tried = [] - for lib_ext in lib_exts: - lib_name = "libpython%s%s%s" % (py_version, lib_suff, lib_ext) - py_library = os.path.join(try_py_libdir, lib_name) - if os.path.exists(py_library): - py_libdir = try_py_libdir - break - libs_tried.append(py_library) + # At least on macOS 10.11, the system Python 2.6 does not include a symlink + # to the framework file disguised as a .dylib file, thus finding the library would + # fail. Manually check if a framework file "Python" exists in the Python framework + # bundle. + if sys.platform == 'darwin' and sys.version_info[:2] == (2, 6): + # These manipulations essentially transform + # /System/Library/Frameworks/Python.framework/Versions/2.6/lib + # to /System/Library/Frameworks/Python.framework/Versions/2.6/Python + possible_framework_path = os.path.realpath(os.path.join(py_libdir, '..')) + possible_framework_version = os.path.basename(possible_framework_path) + possible_framework_library = os.path.join(possible_framework_path, 'Python') + + if possible_framework_version == '2.6' \ + and os.path.exists(possible_framework_library): + py_library = possible_framework_library + python_library_found = True else: - raise DistutilsSetupError( - "Failed to locate the Python library with %s" % - ', '.join(libs_tried)) - else: - raise DistutilsSetupError( - "Failed to locate the Python library with %s" % - ', '.join(libs_tried)) + libs_tried.append(possible_framework_library) + + # Try to find shared libraries which have a multi arch suffix. + if not python_library_found: + py_multiarch = get_config_var("MULTIARCH") + if py_multiarch and not python_library_found: + try_py_libdir = os.path.join(py_libdir, py_multiarch) + libs_tried = [] + for lib_ext in lib_exts: + lib_name = "libpython%s%s%s" % (py_version, lib_suff, lib_ext) + py_library = os.path.join(try_py_libdir, lib_name) + if os.path.exists(py_library): + py_libdir = try_py_libdir + python_library_found = True + break + libs_tried.append(py_library) + + if not python_library_found: + raise DistutilsSetupError( + "Failed to locate the Python library with %s" % + ', '.join(libs_tried)) + if py_library.endswith('.a'): # Python was compiled as a static library log.error("Failed to locate a dynamic Python library, using %s" @@ -630,7 +671,20 @@ class pyside_build(_build): sys.exit(1) # Update the PATH environment variable - update_env_path([py_scripts_dir, qt_dir]) + additionalPaths = [py_scripts_dir, qt_dir] + + # Add Clang to path for Windows. Revisit once Clang is bundled with Qt. + if sys.platform == "win32" and LooseVersion(self.qtinfo.version) >= LooseVersion("5.7.0"): + clangDir = detectClang() + if clangDir[0]: + clangBinDir = os.path.join(clangDir[0], 'bin') + if not clangBinDir in os.environ.get('PATH'): + log.info("Adding %s as detected by %s to PATH" % (clangBinDir, clangDir[1])) + additionalPaths.append(clangBinDir) + else: + log.error("Failed to detect Clang by checking LLVM_INSTALL_DIR, CLANG_INSTALL_DIR, llvm-config") + + update_env_path(additionalPaths) build_name = "py%s-qt%s-%s-%s" % \ (py_version, qt_version, platform.architecture()[0], build_type.lower()) @@ -831,7 +885,13 @@ class pyside_build(_build): cmake_cmd.append("-DOSX_USE_LIBCPP=ON") if OPTION_OSX_SYSROOT: - cmake_cmd.append("-DCMAKE_OSX_SYSROOT={}".format(OPTION_OSX_SYSROOT)) + cmake_cmd.append("-DCMAKE_OSX_SYSROOT={0}".format(OPTION_OSX_SYSROOT)) + else: + latest_sdk_path = run_process_output(['xcrun', '--show-sdk-path']) + if latest_sdk_path: + latest_sdk_path = latest_sdk_path[0] + cmake_cmd.append("-DCMAKE_OSX_SYSROOT={0}".format(latest_sdk_path)) + if not OPTION_SKIP_CMAKE: log.info("Configuring module %s (%s)..." % (extension, module_src_dir)) |