diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 83 |
1 files changed, 53 insertions, 30 deletions
@@ -38,6 +38,7 @@ ############################################################################# from __future__ import print_function +from distutils.version import LooseVersion """This is a distutils setup-script for the PySide2 project @@ -120,15 +121,16 @@ OS X Minimum deployment target: current OS X version and on the chosen SDK version). """ -__version__ = "5.6" +__version__ = "5.9" containedModules = ['shiboken2', 'pyside2'] submodules = { '2.0.0.dev0': [ - ["pyside2-tools", "dev"], - ["pyside2-examples", "dev"], - ["wiki", "master", ".."], + ["pyside2-tools", "dev"] + ], + '5.9': [ + ["pyside2-tools", "5.9"] ], '5.6': [ ["pyside2-tools", "5.6"], @@ -211,7 +213,7 @@ from setuptools.command.develop import develop as _develop from setuptools.command.build_py import build_py as _build_py from qtinfo import QtInfo -from utils import rmtree +from utils import rmtree, detectClang from utils import makefile from utils import copyfile from utils import copydir @@ -283,8 +285,10 @@ OPTION_REUSE_BUILD = has_option("reuse-build") OPTION_SKIP_CMAKE = has_option("skip-cmake") OPTION_SKIP_MAKE_INSTALL = has_option("skip-make-install") OPTION_SKIP_PACKAGING = has_option("skip-packaging") +OPTION_MODULE_SUBSET = option_value("module-subset") OPTION_RPATH_VALUES = option_value("rpath") OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix") +OPTION_QT_SRC = option_value("qt-src-dir") OPTION_ICULIB = option_value("iculib-url") OPTION_VERBOSE_BUILD = has_option("verbose-build") @@ -393,12 +397,6 @@ Use --list-versions option to get list of available versions""" % OPTION_VERSION sys.exit(1) __version__ = OPTION_VERSION -if OPTION_NOEXAMPLES: - # remove pyside2-exampes from submodules so they will not be included - for idx, item in enumerate(submodules[__version__]): - if item[0].startswith('pyside2-examples'): - del submodules[__version__][idx] - # Return a prefix suitable for the _install/_build directory def prefix(): virtualEnvName = os.environ.get('VIRTUAL_ENV', None) @@ -483,10 +481,15 @@ def prepareBuild(): pkg_dir = os.path.join(script_dir, pkg) os.makedirs(pkg_dir) # locate Qt sources for the documentation - qmakeOutput = run_process_output([OPTION_QMAKE, '-query', 'QT_INSTALL_PREFIX/src']) - if qmakeOutput: - global qtSrcDir - qtSrcDir = qmakeOutput[0].rstrip() + if OPTION_QT_SRC is None: + qmakeOutput = run_process_output([OPTION_QMAKE, '-query', 'QT_INSTALL_PREFIX']) + if qmakeOutput: + global qtSrcDir + installPrefix = qmakeOutput[0].rstrip() + if installPrefix.endswith("qtbase"): # In-source, developer build + qtSrcDir = installPrefix + else: # SDK: Use 'Src' directory + qtSrcDir = os.path.join(os.path.dirname(installPrefix), 'Src', 'qtbase') class pyside_install(_install): def _init(self, *args, **kwargs): @@ -746,7 +749,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()) @@ -930,9 +946,20 @@ class pyside_build(_build): cmake_cmd.append("-DPYTHON_EXECUTABLE=%s" % self.py_executable) cmake_cmd.append("-DPYTHON_INCLUDE_DIR=%s" % self.py_include_dir) cmake_cmd.append("-DPYTHON_LIBRARY=%s" % self.py_library) + if OPTION_MODULE_SUBSET: + moduleSubSet = '' + for m in OPTION_MODULE_SUBSET.split(','): + if m.startswith('Qt'): + m = m[2:] + if moduleSubSet: + moduleSubSet += ';' + moduleSubSet += m + cmake_cmd.append("-DMODULES=%s" % moduleSubSet) # Add source location for generating documentation - if qtSrcDir: - cmake_cmd.append("-DQT_SRC_DIR=%s" % qtSrcDir) + cmake_src_dir = OPTION_QT_SRC if OPTION_QT_SRC else qtSrcDir + cmake_cmd.append("-DQT_SRC_DIR=%s" % cmake_src_dir) + log.info("Qt Source dir: %s" % cmake_src_dir) + if self.build_type.lower() == 'debug': cmake_cmd.append("-DPYTHON_DEBUG_LIBRARY=%s" % self.py_library) @@ -1160,12 +1187,10 @@ class pyside_build(_build): "{pyside_package_dir}/PySide2/support", vars=vars) if not OPTION_NOEXAMPLES: - # <sources>/pyside2-examples/examples/* -> <setup>/PySide2/examples - folder = get_extension_folder('pyside2-examples') - copydir( - "{sources_dir}/%s/examples" % folder, - "{pyside_package_dir}/PySide2/examples", - force=False, vars=vars) + # examples/* -> <setup>/PySide2/examples + copydir(os.path.join(self.script_dir, "examples"), + "{pyside_package_dir}/PySide2/examples", + force=False, vars=vars) # Re-generate examples Qt resource files for Python 3 compatibility if sys.version_info[0] == 3: examples_path = "{pyside_package_dir}/PySide2/examples".format(**vars) @@ -1416,12 +1441,10 @@ class pyside_build(_build): "{pyside_package_dir}/PySide2/support", vars=vars) if not OPTION_NOEXAMPLES: - # <sources>/pyside2-examples/examples/* -> <setup>/PySide2/examples - folder = get_extension_folder('pyside2-examples') - copydir( - "{sources_dir}/%s/examples" % folder, - "{pyside_package_dir}/PySide2/examples", - force=False, vars=vars) + # examples/* -> <setup>/PySide2/examples + copydir(os.path.join(self.script_dir, "examples"), + "{pyside_package_dir}/PySide2/examples", + force=False, vars=vars) # Re-generate examples Qt resource files for Python 3 compatibility if sys.version_info[0] == 3: examples_path = "{pyside_package_dir}/PySide2/examples".format(**vars) |