--- configure.py.orig +++ configure.py @@ -39,6 +39,7 @@ qt_dir = None qt_incdir = None qt_libdir = None +qt_frameworkdir = None qt_bindir = None qt_datadir = None qt_archdatadir = None @@ -513,7 +514,39 @@ generate_code("QtXmlPatterns") if "phonon" in pyqt_modules: - generate_code("phonon") + # check to see if phonon is installed by Qt or external to + # it. adding to the include path and library path will not + # hurt if Qt installed phonon, and will get the headers + # and library if phonon was installed external to Qt. + phononincdirs = [] + phononlibdirs = [] + sout = get_command_stdout("pkg-config --cflags-only-I --libs phonon") + iflags = sout.read().strip() + if iflags: + sout = get_command_stdout("%s -query QT_INSTALL_PREFIX" % opts.qmake) + qt_install_prefix = sout.read().strip() + if sys.hexversion >= 0x03000000: + iflags = iflags.decode() + qt_install_prefix = qt_install_prefix.decode() + for f in iflags.split(): + # look for flags outside the Qt install prefix only + if f.find(qt_install_prefix) == -1: + if f.startswith("-I"): + tdir = f[2:] + phononincdirs.append(tdir) + if not tdir.endswith("phonon"): + phononincdirs.append(tdir + "/phonon") + elif f.startswith("-L"): + phononlibdirs.append(f[2:]) + + if opts.bigqt: + cons_xtra_incdirs.append(phononincdirs) + cons_xtra_libdirs.append(phononlibdirs) + + generate_code("phonon") + else: + generate_code("phonon", extra_include_dirs=phononincdirs, + extra_lib_dirs=phononlibdirs) if "QtAssistant" in pyqt_modules: generate_code("QtAssistant") @@ -973,18 +1006,7 @@ dynamic_pylib = "--enable-shared" in config_args if dynamic_pylib: - if glob.glob("%s/lib/libpython%d.%d*" % (ducfg["exec_prefix"], py_major, py_minor)): - lib_dir_flag = quote("-L%s/lib" % ducfg["exec_prefix"]) - elif 'MULTIARCH' in ducfg and glob.glob('%s/lib/%s/libpython%d.%d*' % (ducfg['exec_prefix'], ducfg['MULTIARCH'], py_major, py_minor)): - lib_dir_flag = quote('-L%s/lib/%s' % (ducfg['exec_prefix'], ducfg['MULTIARCH'])) - elif glob.glob("%s/libpython%d.%d*" % (ducfg["LIBDIR"], py_major, py_minor)): - lib_dir_flag = quote("-L%s" % ducfg["LIBDIR"]) - else: - sipconfig.inform("Qt Designer plugin disabled because Python library couldn't be found") - lib_dir_flag = '' - opts.designer_plugin = False - - link = "%s -lpython%d.%d%s" % (lib_dir_flag, py_major, py_minor, abi) + link = "%s @@MACPORTS_PYTHON_FRAMEWORK@@" % sipcfg.build_macros().get('LFLAGS', '') else: sipconfig.inform("The Qt Designer plugin was disabled because a dynamic Python library couldn't be found") opts.designer_plugin = False @@ -1083,7 +1105,10 @@ sipconfig.inform("SIP %s is being used." % sipcfg.sip_version_str) sipconfig.inform("The Qt header files are in %s." % qt_incdir) - sipconfig.inform("The %s Qt libraries are in %s." % (lib_type, qt_libdir)) + if sys.platform == "darwin" and qt_framework: + sipconfig.inform("The %s Qt frameworks are in %s." % (lib_type, qt_frameworkdir)) + else: + sipconfig.inform("The %s Qt libraries are in %s." % (lib_type, qt_libdir)) sipconfig.inform("The Qt binaries are in %s." % qt_bindir) sipconfig.inform("The Qt mkspecs directory is in %s." % qt_archdatadir) sipconfig.inform("These PyQt modules will be built: %s." % ", ".join(pyqt_modules)) @@ -1148,7 +1173,8 @@ "qt_data_dir": qt_datadir, "qt_archdata_dir": qt_archdatadir, "qt_inc_dir": qt_incdir, - "qt_lib_dir": qt_libdir + "qt_lib_dir": qt_libdir, + "qt_framework_dir": qt_frameworkdir } sipconfig.create_config_module(module, template, content, macros) @@ -1740,7 +1766,7 @@ lfile = license.LicenseFile except AttributeError: lfile = None - except ImportError: + except: ltype = None if ltype is None: @@ -1845,12 +1871,14 @@ names = list(sipcfg.build_macros().keys()) names.append("INCDIR_QT") names.append("LIBDIR_QT") + names.append("FRAMEWORKDIR_QT") names.append("MOC") properties = { "QT_INSTALL_BINS": qt_bindir, "QT_INSTALL_HEADERS": qt_incdir, - "QT_INSTALL_LIBS": qt_libdir + "QT_INSTALL_LIBS": qt_libdir, + "QT_INSTALL_FRAMEWORKS": qt_frameworkdir } macros = sipconfig.parse_build_macros(fname, names, overrides, properties) @@ -1896,7 +1924,7 @@ # Work out how Qt was built on MacOS. if sys.platform == "darwin": - if os.access(os.path.join(qt_libdir, "QtCore.framework"), os.F_OK): + if os.access(os.path.join(qt_frameworkdir, "QtCore.framework"), os.F_OK): global qt_framework qt_framework = 1 @@ -1913,6 +1941,7 @@ sipcfg.qt_threaded = 1 sipcfg.qt_dir = qt_dir sipcfg.qt_lib_dir = qt_libdir + sipcfg.qt_framework_dir = qt_frameworkdir return ConfigurePyQt4(generator) @@ -1928,7 +1957,7 @@ def get_qt_configuration(): - """Set the qt_dir, qt_incdir, qt_libdir, qt_bindir, qt_datadir, + """Set the qt_dir, qt_incdir, qt_libdir, qt_frameworkdir, qt_bindir, qt_datadir, qt_archdatadir, qt_pluginsdir and qt_xfeatures globals for the Qt installation. """ @@ -2000,6 +2029,7 @@ out << QLibraryInfo::location(QLibraryInfo::PrefixPath) << '\\n'; out << QLibraryInfo::location(QLibraryInfo::HeadersPath) << '\\n'; out << QLibraryInfo::location(QLibraryInfo::LibrariesPath) << '\\n'; + out << QLibraryInfo::location(QLibraryInfo::FrameworksPath) << '\\n'; out << QLibraryInfo::location(QLibraryInfo::BinariesPath) << '\\n'; out << QLibraryInfo::location(QLibraryInfo::DataPath) << '\\n'; #if QT_VERSION >= 0x050000 @@ -2128,22 +2158,23 @@ lines = f.read().strip().split("\n") f.close() - global qt_dir, qt_incdir, qt_libdir, qt_bindir, qt_datadir, qt_archdatadir + global qt_dir, qt_incdir, qt_libdir, qt_frameworkdir, qt_bindir, qt_datadir, qt_archdatadir global qt_pluginsdir global qt_version, qt_edition, qt_licensee, qt_shared, qt_xfeatures qt_dir = lines[0] qt_incdir = lines[1] qt_libdir = lines[2] - qt_bindir = lines[3] - qt_datadir = lines[4] - qt_archdatadir = lines[5] - qt_pluginsdir = lines[6] - qt_version = lines[7] - qt_edition = lines[8] - qt_licensee = lines[9] - qt_shared = lines[10] - qt_xfeatures = lines[11:] + qt_frameworkdir = lines[3] + qt_bindir = lines[4] + qt_datadir = lines[5] + qt_archdatadir = lines[6] + qt_pluginsdir = lines[7] + qt_version = lines[8] + qt_edition = lines[9] + qt_licensee = lines[10] + qt_shared = lines[11] + qt_xfeatures = lines[12:] if opts.assume_shared: qt_shared = 'shared' @@ -2206,6 +2237,11 @@ p = create_optparser() opts, args = p.parse_args() + # fix arch on darwin + if sys.platform == 'darwin' and opts.use_arch is not None: + # convert opts.use_arch from a list to a string + sipcfg.arch = ' '.join(iter(opts.use_arch)) + # Provide defaults for platform-specific options. if sys.platform == 'win32': opts.qmake = find_default_qmake() @@ -2323,7 +2359,6 @@ raise except: sys.stderr.write( -"""An internal error occured. Please report all the output from the program, -including the following traceback, to support@riverbankcomputing.com. +"""An internal error occured. Please follow the instructions provided by MacPorts < http://www.macports.org > to report this issue. Please do not report this issue to Riverbank Computing until MacPorts developers have determined that it is appropriate to do so. """) raise