aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py75
1 files changed, 54 insertions, 21 deletions
diff --git a/setup.py b/setup.py
index 57214685d..a348ee383 100644
--- a/setup.py
+++ b/setup.py
@@ -38,6 +38,7 @@
#############################################################################
from __future__ import print_function
+from distutils.version import LooseVersion
"""This is a distutils setup-script for the PySide2 project
@@ -94,7 +95,7 @@ OS X SDK: You can specify which OS X SDK should be used for compilation with the
For e.g. "--osx-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/".
"""
-__version__ = "5.6"
+__version__ = "5.9"
containedModules = ['shiboken2', 'pyside2']
@@ -104,6 +105,11 @@ submodules = {
["pyside2-examples", "dev"],
["wiki", "master", ".."],
],
+ '5.9': [
+ ["pyside2-tools", "5.9"],
+ ["pyside2-examples", "5.9"],
+ ["wiki", "master", ".."]
+ ],
'5.6': [
["pyside2-tools", "5.6"],
["pyside2-examples", "5.6"],
@@ -183,7 +189,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
@@ -253,8 +259,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")
if OPTION_QT_VERSION is None:
@@ -446,10 +454,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):
@@ -709,7 +722,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())
@@ -871,9 +897,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)
@@ -1084,12 +1121,10 @@ class pyside_build(_build):
"{dist_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,
- "{dist_dir}/PySide2/examples",
- force=False, vars=vars)
+ # examples/* -> <setup>/PySide2/examples
+ copydir(os.path.join(self.script_dir, "examples"),
+ "{dist_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 = "{dist_dir}/PySide2/examples".format(**vars)
@@ -1356,12 +1391,10 @@ class pyside_build(_build):
"{dist_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,
- "{dist_dir}/PySide2/examples",
- force=False, vars=vars)
+ # examples/* -> <setup>/PySide2/examples
+ copydir(os.path.join(self.script_dir, "examples"),
+ "{dist_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 = "{dist_dir}/PySide2/examples".format(**vars)