diff options
author | Roman Lacko <backup.rlacko@gmail.com> | 2013-06-03 23:56:49 -0700 |
---|---|---|
committer | Roman Lacko <backup.rlacko@gmail.com> | 2013-06-03 23:56:49 -0700 |
commit | d5d22fe75e9727d0d5aad8186f8cbad6283924af (patch) | |
tree | 367b4588e3deedefa7f0d22bdb6ca6b85a63adfb | |
parent | 4d0046743b475c0a1aa3d768e3f76973b1ac4786 (diff) | |
parent | 60568283ea1e014d76959203cbd278b2dbe3bfc7 (diff) |
Merge pull request #13 from RobinD42/more-build-tweaks
More build tweaks and fixes
-rw-r--r-- | setup.py | 29 | ||||
-rw-r--r-- | utils.py | 2 |
2 files changed, 25 insertions, 6 deletions
@@ -340,6 +340,8 @@ class pyside_build(_build): py_include_dir = get_config_var("INCLUDEPY") py_libdir = get_config_var("LIBDIR") py_prefix = get_config_var("prefix") + if not py_prefix or not os.path.exists(py_prefix): + py_prefix = sys.prefix if sys.platform == "win32": py_scripts_dir = os.path.join(py_prefix, "Scripts") else: @@ -349,6 +351,11 @@ class pyside_build(_build): py_libdir = os.path.join(py_prefix, "libs") else: py_libdir = os.path.join(py_prefix, "lib") + if py_include_dir is None or not os.path.exists(py_include_dir): + if sys.platform == "win32": + py_include_dir = os.path.join(py_prefix, "include") + else: + py_include_dir = os.path.join(py_prefix, "include/python%s" % py_version) dbgPostfix = "" if build_type == "Debug": dbgPostfix = "_d" @@ -419,6 +426,13 @@ class pyside_build(_build): build_dir = os.path.join(script_dir, os.path.join("pyside_build", "%s" % build_name)) install_dir = os.path.join(script_dir, os.path.join("pyside_install", "%s" % build_name)) + # Try to ensure that tools built by this script (such as shiboken) + # are found before any that may already be installed on the system. + update_env_path([os.path.join(install_dir, 'bin')], log) + + # Tell cmake to look here for *.cmake files + os.environ['CMAKE_PREFIX_PATH'] = install_dir + self.make_path = make_path self.make_generator = make_generator self.debug = OPTION_DEBUG @@ -512,7 +526,7 @@ class pyside_build(_build): log.info("Deleting module build folder %s..." % module_build_dir) rmtree(module_build_dir) log.info("Creating module build folder %s..." % module_build_dir) - os.mkdir(module_build_dir) + os.makedirs(module_build_dir) os.chdir(module_build_dir) module_src_dir = os.path.join(self.sources_dir, extension) @@ -549,10 +563,15 @@ class pyside_build(_build): if sys.version_info[0] > 2: cmake_cmd.append("-DUSE_PYTHON3=ON") elif sys.platform == 'darwin': - # Work round cmake include problem - # http://neilweisenfeld.com/wp/120/building-pyside-on-the-mac - # https://groups.google.com/forum/#!msg/pyside/xciZZ4Hm2j8/CUmqfJptOwoJ - cmake_cmd.append('-DALTERNATIVE_QT_INCLUDE_DIR=/Library/Frameworks') + if 'QTDIR' in os.environ: + # If the user has QTDIR set, then use it as a prefix for an extra include path + cmake_cmd.append('-DALTERNATIVE_QT_INCLUDE_DIR={0}/include:{0}/lib'.format(os.environ['QTDIR'])) + else: + # Otherwise assume it is a standard install and add the + # Frameworks folder as a workaround for a cmake include problem + # http://neilweisenfeld.com/wp/120/building-pyside-on-the-mac + # https://groups.google.com/forum/#!msg/pyside/xciZZ4Hm2j8/CUmqfJptOwoJ + cmake_cmd.append('-DALTERNATIVE_QT_INCLUDE_DIR=/Library/Frameworks') log.info("Configuring module %s (%s)..." % (extension, module_src_dir)) if run_process(cmake_cmd, log) != 0: @@ -59,7 +59,7 @@ def update_env_path(newpaths, logger): if not path.lower() in paths: logger.info("Inserting path \"%s\" to environment" % path) paths.insert(0, path) - os.environ['PATH'] = os.pathsep.join(paths) + os.environ['PATH'] = path + os.pathsep + os.environ['PATH'] def find_vcvarsall(version): |