[111812] trunk/dports/python/py-pyqt4

michaelld at macports.org michaelld at macports.org
Wed Oct 2 09:54:15 PDT 2013


Revision: 111812
          https://trac.macports.org/changeset/111812
Author:   michaelld at macports.org
Date:     2013-10-02 09:54:15 -0700 (Wed, 02 Oct 2013)
Log Message:
-----------
py*-pyqt4:
* add 'devel' version for latest changes;
* add configure post_args variables to handle compiler and flags correctly;
* add patch and tweak configure args to honor selected arch(s);
* use dbus-python for Python < 3;
* addresses ticket #40527.

Modified Paths:
--------------
    trunk/dports/python/py-pyqt4/Portfile
    trunk/dports/python/py-pyqt4/files/patch-configure.py.diff

Added Paths:
-----------
    trunk/dports/python/py-pyqt4/files/patch-configure.py-devel.diff

Modified: trunk/dports/python/py-pyqt4/Portfile
===================================================================
--- trunk/dports/python/py-pyqt4/Portfile	2013-10-02 16:42:22 UTC (rev 111811)
+++ trunk/dports/python/py-pyqt4/Portfile	2013-10-02 16:54:15 UTC (rev 111812)
@@ -6,8 +6,6 @@
 PortGroup       python 1.0
 
 name            py-pyqt4
-version         4.10.3
-revision        1
 python.versions 24 25 26 27 31 32 33
 python.default_version 27
 categories-append     devel
@@ -22,61 +20,60 @@
     and contains 300 classes and over 5,750 functions and methods.
 homepage        http://www.riverbankcomputing.co.uk/software/pyqt/intro
 
-if {$subport != $name} {
+foreach py_ver ${python.versions} {
+    subport py${py_ver}-pyqt4-devel {
+        conflicts py${py_ver}-pyqt4
+    }
+    subport py${py_ver}-pyqt4 {
+        conflicts py${py_ver}-pyqt4-devel
+    }
+}
 
-    master_sites    sourceforge:pyqt
-    distname        PyQt-mac-gpl-${version}
-    dist_subdir     python
+if {$subport ne $name} {
 
-    checksums       sha1    ba5465f92fb43c9f0a5b948fa25df5045f160bf0 \
-                    rmd160  5c05cf922264ee7a9a942e47e55d0342987b28d2
+    set patch 4.10
 
-    depends_lib-append port:py${python.version}-sip \
-                       port:qt4-mac
+    if {[string last devel ${subport}] != -1} {
 
-    configure.args-append   -e QtGui \
-                            -e QtHelp \
-                            -e QtMultimedia \
-                            -e QtNetwork \
-                            -e QtDeclarative \
-                            -e QtOpenGL \
-                            -e QtScript \
-                            -e QtScriptTools \
-                            -e QtSql \
-                            -e QtSvg \
-                            -e QtTest \
-                            -e QtWebKit \
-                            -e QtXml \
-                            -e QtXmlPatterns \
-                            -e QAxContainer \
-                            --no-qsci-api
+        # devel port; use different download info
 
-    # Don't build designer plugin for 2.4; not built as a framework
-    if {${python.version} != 24 } {
-        configure.args-append   -e QtDesigner
-    }
+        version         ${patch}.4
+        set snapshot    507d15ce70b8
 
-    variant phonon description {Add phonon support} {
-        configure.args-append   -e phonon
-        depends_lib-append      port:phonon
-    }
+        master_sites    http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4
+        distname        PyQt-mac-gpl-${version}-snapshot-${snapshot}
 
-    if {${python.version} == 26 || ${python.version} == 27} {
-        variant scintilla description {Add QScintilla API file } {
-            configure.args-delete   --no-qsci-api
-            configure.args-append   --qsci-api
-            depends_lib-append      port:qscintilla
-        }
+        checksums       rmd160 60d69b6faa6c4266ee6caf09874d64a61e6539a8 \
+                        sha256 39c4c24f0e1da19a674f7750b4d15ca276871cc42fc8e64e3c7c6b966c286339
+
+        patchfiles-append patch-configure.py-devel.diff
+
+    } else {
+
+        version         ${patch}.3
+        revision        2
+
+        master_sites    sourceforge:pyqt
+        distname        PyQt-mac-gpl-${version}
+
+        checksums       rmd160 5c05cf922264ee7a9a942e47e55d0342987b28d2 \
+                        sha256 d985ad0b19939eb60f2689329f8272ad986acfe2f001f8ab67931c961239030b
+
+        patchfiles-append patch-configure.py.diff
+
     }
 
-    # The patch file alters configure.py so that the qtdesigner plugin
-    # can link.  It ensures that both LFLAGS are included and that the
-    # relevant version framework is linked.  It also adds a
-    # "framework" directory concept to make the split in qt4-mac as of
-    # 4.8.0, and uses it where appropriate.
+    dist_subdir        python
 
-    patchfiles      patch-configure.py.diff
+    depends_lib-append port:py${python.version}-sip \
+                       port:qt4-mac
 
+    # patch-configure.py* file alters configure.py so that the
+    # qtdesigner plugin can link.  It ensures that both LFLAGS are
+    # included and that the relevant version framework is linked.  It
+    # also adds a "framework" directory concept to make the split in
+    # qt4-mac as of 4.8.0, and uses it where appropriate.
+
     # fix location of MacPorts'-installed Qt .apps, step 1
 
     patchfiles-append patch-fix-qt_apps_dir.diff
@@ -98,25 +95,81 @@
         if {[tbool configure.ccache]} {
             configure.env-append "CCACHE=ccache"
         }
+
+        foreach arch [get_canonical_archs] {
+            configure.args-append --use-arch=$arch
+        }
     }
 
     configure.cmd       "${python.bin} configure.py -q ${qt_qmake_cmd} --verbose --confirm-license"
     configure.pre_args
-    configure.post_args LFLAGS="-F${frameworks_dir} -L${prefix}/lib"
+    configure.universal_args-delete --disable-dependency-tracking
 
+    configure.args-append   -e QtGui \
+                            -e QtHelp \
+                            -e QtMultimedia \
+                            -e QtNetwork \
+                            -e QtDeclarative \
+                            -e QtOpenGL \
+                            -e QtScript \
+                            -e QtScriptTools \
+                            -e QtSql \
+                            -e QtSvg \
+                            -e QtTest \
+                            -e QtWebKit \
+                            -e QtXml \
+                            -e QtXmlPatterns \
+                            -e QAxContainer \
+                            --no-qsci-api
+
+    # SIP's configure tools ignore environment variables, so have to
+    # get important once in in other ways if/as possible; SIP will, by
+    # default, use what was found by QMake when qt4-mac was installed.
+
+    set cflags   "${configure.cflags}"
+    set cxxflags "${configure.cxxflags}"
+    if {[tbool configure.pipe]} {
+        set cflags   "${cflags} -pipe"
+        set cxxflags "${cxxflags} -pipe"
+    }
+
+    configure.post_args \
+        CC=${configure.cc} \
+        CXX=${configure.cxx} \
+        LFLAGS="-F${frameworks_dir} ${configure.ldflags}" \
+        CFLAGS="${cflags}" \
+        CXXFLAGS="${cxxflags}"
+
+    # support for dbus-python in < 3.0
+
+    if {${python.version} < 30} {
+        depends_lib-append port:dbus-python${python.version}
+        configure.args-append --dbus=${python.include}/dbus-1.0
+    }
+
     # subport for Python 2.4 or 2.5 installs into non-Framework locations
     if {${python.version} <= 25} {
         configure.cmd-append " -d ${python.pkgd} -b ${prefix}/bin"
     }
 
-    variant universal {
-        configure.universal_args
-        configure.post_args         LFLAGS="-F${frameworks_dir} -L${prefix}/lib \
-                                    ${configure.universal_ldflags}"
-        configure.post_args-append  CFLAGS="${configure.universal_cflags}"
-        configure.post_args-append  CXXFLAGS="${configure.universal_cxxflags}"
+    # Don't build designer plugin for 2.4; not built as a framework
+    if {${python.version} != 24 } {
+        configure.args-append   -e QtDesigner
     }
 
+    variant phonon description {Add phonon support} {
+        configure.args-append   -e phonon
+        depends_lib-append      port:phonon
+    }
+
+    if {${python.version} == 26 || ${python.version} == 27} {
+        variant scintilla description {Add QScintilla API file } {
+            configure.args-delete   --no-qsci-api
+            configure.args-append   --qsci-api
+            depends_lib-append      port:qscintilla
+        }
+    }
+
     post-configure {
         if {[variant_isset universal]} {
             set conflags ""
@@ -213,6 +266,18 @@
 
 }
 
-livecheck.type   regex
-livecheck.url    http://www.riverbankcomputing.co.uk/software/pyqt/download
-livecheck.regex  >PyQt-mac-gpl-(\[0-9.\]*).tar.gz<
+if {[string last devel ${subport}] != -1} {
+
+    livecheck.type   regex
+    livecheck.url    http://www.riverbankcomputing.co.uk/software/pyqt/download
+    livecheck.version ${version}-snapshot-${snapshot}
+    livecheck.regex  >PyQt-mac-gpl-(\[0-9.\]*-snapshot-\[0-9a-e\]*).tar.gz<
+
+} else {
+
+    livecheck.type   regex
+    livecheck.url    http://www.riverbankcomputing.co.uk/software/pyqt/download
+    livecheck.regex  >PyQt-mac-gpl-(\[0-9.\]*).tar.gz<
+
+}
+

Added: trunk/dports/python/py-pyqt4/files/patch-configure.py-devel.diff
===================================================================
--- trunk/dports/python/py-pyqt4/files/patch-configure.py-devel.diff	                        (rev 0)
+++ trunk/dports/python/py-pyqt4/files/patch-configure.py-devel.diff	2013-10-02 16:54:15 UTC (rev 111812)
@@ -0,0 +1,175 @@
+--- configure.py.orig	2013-10-02 10:20:42.000000000 -0400
++++ configure.py	2013-10-02 10:21:52.000000000 -0400
+@@ -44,6 +44,7 @@
+ qt_dir = None
+ qt_incdir = None
+ qt_libdir = None
++qt_frameworkdir = None
+ qt_bindir = None
+ qt_datadir = None
+ qt_archdatadir = None
+@@ -210,7 +211,7 @@
+ 
+     if sys.platform == 'darwin':
+         g = optparse.OptionGroup(p, title="MacOS X Configuration")
+-        g.add_option("--use-arch", action="store", metavar="ARCH",
++        g.add_option("--use-arch", action="append", metavar="ARCH",
+                 dest="use_arch", choices=["i386", "x86_64", "ppc"],
+                 help="the architecture to use when running pyuic4 "
+                         "[default: system default]")
+@@ -975,18 +976,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("Qt Designer plugin disabled because Python library is static")
+                     opts.designer_plugin = False
+@@ -1085,7 +1075,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))
+@@ -1150,7 +1143,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)
+@@ -1806,7 +1800,7 @@
+             lfile = license.LicenseFile
+         except AttributeError:
+             lfile = None
+-    except ImportError:
++    except:
+         ltype = None
+ 
+     if ltype is None:
+@@ -1923,12 +1917,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)
+@@ -1974,7 +1970,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
+ 
+@@ -1991,6 +1987,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)
+ 
+@@ -2006,7 +2003,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.
+     """
+@@ -2080,6 +2077,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
+@@ -2208,22 +2206,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"
+@@ -2284,6 +2283,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
++        opts.use_arch = sipcfg.arch = ' '.join(iter(opts.use_arch))
++
+     # Provide defaults for platform-specific options.
+     if sys.platform == 'win32':
+         opts.qmake = find_default_qmake()
+@@ -2401,7 +2405,6 @@
+         raise
+     except:
+         sys.stderr.write(
+-"""An internal error occured.  Please report all the output from the program,
+-including the following traceback, to support at 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

Modified: trunk/dports/python/py-pyqt4/files/patch-configure.py.diff
===================================================================
--- trunk/dports/python/py-pyqt4/files/patch-configure.py.diff	2013-10-02 16:42:22 UTC (rev 111811)
+++ trunk/dports/python/py-pyqt4/files/patch-configure.py.diff	2013-10-02 16:54:15 UTC (rev 111812)
@@ -1,5 +1,5 @@
---- configure.py.orig	2013-08-21 02:02:48.000000000 -0400
-+++ configure.py	2013-08-21 20:03:43.000000000 -0400
+--- configure.py.orig	2013-10-02 10:33:49.000000000 -0400
++++ configure.py	2013-10-02 10:34:47.000000000 -0400
 @@ -44,6 +44,7 @@
  qt_dir = None
  qt_incdir = None
@@ -8,6 +8,15 @@
  qt_bindir = None
  qt_datadir = None
  qt_archdatadir = None
+@@ -210,7 +211,7 @@
+ 
+     if sys.platform == 'darwin':
+         g = optparse.OptionGroup(p, title="MacOS X Configuration")
+-        g.add_option("--use-arch", action="store", metavar="ARCH",
++        g.add_option("--use-arch", action="append", metavar="ARCH",
+                 dest="use_arch", choices=["i386", "x86_64", "ppc"],
+                 help="the architecture to use when running pyuic4 "
+                         "[default: system default]")
 @@ -975,16 +976,7 @@
                      dynamic_pylib = "--enable-shared" in config_args
  
@@ -141,3 +150,24 @@
  
      if opts.assume_shared:
          qt_shared = "shared"
+@@ -2282,6 +2283,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
++        opts.use_arch = sipcfg.arch = ' '.join(iter(opts.use_arch))
++
+     # Provide defaults for platform-specific options.
+     if sys.platform == 'win32':
+         opts.qmake = find_default_qmake()
+@@ -2399,7 +2405,6 @@
+         raise
+     except:
+         sys.stderr.write(
+-"""An internal error occured.  Please report all the output from the program,
+-including the following traceback, to support at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131002/c7b7f426/attachment.html>


More information about the macports-changes mailing list