diff options
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | qtinfo.py | 21 | ||||
-rw-r--r-- | setup.py | 33 |
4 files changed, 48 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..8b1771273 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python +dist: trusty +python: + - "2.7" + - "3.5" +before_install: + - sudo add-apt-repository ppa:beineri/opt-qt551-trusty -y + - sudo apt-get update +install: + - sudo apt-get install qt55-meta-full -y +script: + - source /opt/qt55/bin/qt55-env.sh + - python setup.py install --jobs=2 --build-tests # --openssl=/path/to/openssl/bin @@ -20,6 +20,8 @@ any contribution without requiring a transfer of copyright. PySide 2 supports Qt5. For building, please read about [getting the dependencies](https://github.com/PySide/pyside2/wiki/Dependencies). Then download the sources by running `git clone --recursive https://github.com/PySide/pyside2-setup.git`. +[![Build Status](https://travis-ci.org/PySide/pyside2-setup.svg?branch=master)](https://travis-ci.org/PySide/pyside2-setup) + ###Building ####Windows @@ -1,16 +1,19 @@ -import sys +import os, sys import subprocess from distutils.spawn import find_executable class QtInfo(object): - def __init__(self, qmake_path=None): - if qmake_path: - self._qmake_path = qmake_path + def __init__(self, qmake_command=None): + if qmake_command: + self._qmake_command = qmake_command else: - self._qmake_path = find_executable("qmake") + self._qmake_command = [find_executable("qmake"),] - def getQMakePath(self): - return self._qmake_path + def getQMakeCommand(self): + qmake_command_string = self._qmake_command[0] + for entry in self._qmake_command[1:]: + qmake_command_string += " %s" %(entry) + return qmake_command_string def getVersion(self): return self.getProperty("QT_VERSION") @@ -37,7 +40,7 @@ class QtInfo(object): return self.getProperty("QT_INSTALL_DOCS") def getProperty(self, prop_name): - cmd = [self._qmake_path, "-query", prop_name] + cmd = self._qmake_command + ["-query", prop_name] proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, shell=False) prop = proc.communicate()[0] proc.wait() @@ -51,7 +54,7 @@ class QtInfo(object): bins_dir = property(getBinsPath) libs_dir = property(getLibsPath) plugins_dir = property(getPluginsPath) - qmake_path = property(getQMakePath) + qmake_command = property(getQMakeCommand) imports_dir = property(getImportsPath) translations_dir = property(getTranslationsPath) headers_dir = property(getHeadersPath) @@ -146,6 +146,7 @@ check_allowed_python_version() OPTION_DEBUG = has_option("debug") OPTION_RELWITHDEBINFO = has_option('relwithdebinfo') OPTION_QMAKE = option_value("qmake") +OPTION_QT_VERSION = option_value("qt") OPTION_CMAKE = option_value("cmake") OPTION_OPENSSL = option_value("openssl") OPTION_ONLYPACKAGE = has_option("only-package") @@ -161,10 +162,21 @@ OPTION_BUILDTESTS = has_option("build-tests") OPTION_OSXARCH = option_value("osx-arch") OPTION_XVFB = has_option("use-xvfb") +if OPTION_QT_VERSION is None: + OPTION_QT_VERSION = "5" if OPTION_QMAKE is None: OPTION_QMAKE = find_executable("qmake-qt5") if OPTION_QMAKE is None: OPTION_QMAKE = find_executable("qmake") + +QMAKE_COMMAND = None +if os.path.exists(OPTION_QMAKE): # Checking whether qmake executable exists + if os.path.islink(OPTION_QMAKE) and os.path.lexists(OPTION_QMAKE): # Looking whether qmake path is a link and whether the link exists + if "qtchooser" in os.readlink(OPTION_QMAKE): # Set -qt=X here. + QMAKE_COMMAND = [OPTION_QMAKE, "-qt=%s" %(OPTION_QT_VERSION)] +if not QMAKE_COMMAND: + QMAKE_COMMAND = [OPTION_QMAKE] + if OPTION_CMAKE is None: OPTION_CMAKE = find_executable("cmake") @@ -319,7 +331,6 @@ class pyside_build(_build): self.sources_dir = None self.build_dir = None self.install_dir = None - self.qmake_path = None self.py_executable = None self.py_include_dir = None self.py_library = None @@ -460,11 +471,11 @@ class pyside_build(_build): log.error("Failed to locate a dynamic Python library, using %s" % py_library) - qtinfo = QtInfo(OPTION_QMAKE) + self.qtinfo = QtInfo(QMAKE_COMMAND) qt_dir = os.path.dirname(OPTION_QMAKE) - qt_version = qtinfo.version + qt_version = self.qtinfo.version if not qt_version: - log.error("Failed to query the Qt version with qmake %s" % qtinfo.qmake_path) + log.error("Failed to query the Qt version with qmake %s" % self.qtinfo.qmake_command) sys.exit(1) # Update the PATH environment variable @@ -492,13 +503,11 @@ class pyside_build(_build): self.sources_dir = sources_dir self.build_dir = build_dir self.install_dir = install_dir - self.qmake_path = OPTION_QMAKE self.py_executable = py_executable self.py_include_dir = py_include_dir self.py_library = py_library self.py_version = py_version self.build_type = build_type - self.qtinfo = qtinfo self.site_packages_dir = get_python_lib(1, 0, prefix=install_dir) self.build_tests = OPTION_BUILDTESTS @@ -523,11 +532,11 @@ class pyside_build(_build): log.info("Python prefix: %s" % py_prefix) log.info("Python scripts: %s" % py_scripts_dir) log.info("-" * 3) - log.info("Qt qmake: %s" % self.qmake_path) - log.info("Qt version: %s" % qtinfo.version) - log.info("Qt bins: %s" % qtinfo.bins_dir) - log.info("Qt docs: %s" % qtinfo.docs_dir) - log.info("Qt plugins: %s" % qtinfo.plugins_dir) + log.info("Qt qmake: %s" % self.qtinfo.qmake_command) + log.info("Qt version: %s" % self.qtinfo.version) + log.info("Qt bins: %s" % self.qtinfo.bins_dir) + log.info("Qt docs: %s" % self.qtinfo.docs_dir) + log.info("Qt plugins: %s" % self.qtinfo.plugins_dir) log.info("-" * 3) log.info("OpenSSL libs: %s" % OPTION_OPENSSL) log.info("=" * 30) @@ -602,7 +611,7 @@ class pyside_build(_build): cmake_cmd = [ OPTION_CMAKE, "-G", self.make_generator, - "-DQT_QMAKE_EXECUTABLE=%s" % self.qmake_path, + "-DQT_QMAKE_EXECUTABLE='%s'" % self.qtinfo.qmake_command, "-DBUILD_TESTS=%s" % self.build_tests, "-DDISABLE_DOCSTRINGS=True", "-DQt5Help_DIR=%s" % self.qtinfo.docs_dir, |