aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index 33daad13a..0ff5dfbb3 100644
--- a/setup.py
+++ b/setup.py
@@ -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: