Package: python-qt4
Version: 4.6-1
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

with a fixed sip4 (cfr #560418), python-qt4 fails to configure on GNU/Hurd.
The problem is basically the same as bug #560418: patch 01_configure has the
code snippet:
+    except OSError, e:
+        if e.errno != 17:
+            raise
which relies on the actual implementation of the various errno values.
The easy fix is to use the errno Python module and its EEXIST constant.
Attached there is the modified version of patch 01_configure with the above
change.

Thanks,
-- 
Pino
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01_configure.dpatch by Torsten Marek <shlo...@debian.org>
##
## DP: Make PyQt4 objectdir-buildable

@DPATCH@
diff -urNad python-qt4-4.6~/configure.py python-qt4-4.6/configure.py
--- python-qt4-4.6~/configure.py	2009-09-26 11:19:41.000000000 -0400
+++ python-qt4-4.6/configure.py	2009-10-07 10:03:11.173526146 -0400
@@ -28,6 +28,8 @@
 # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
 
+# Modified for Debian by Torsten Marek <shlo...@gmx.net>
+
 import sys
 import os
 import glob
@@ -36,6 +38,24 @@
 
 import sipconfig
 
+topsrcdir = os.path.dirname(os.path.abspath(__file__))
+has_objdir = topsrcdir != os.path.abspath(os.path.curdir)
+if not has_objdir:
+    topsrcdir = None
+
+
+def makeDir(dirname):
+    try:
+        os.mkdir(dirname)
+    except OSError, e:
+        import errno
+        if e.errno != errno.EEXIST:
+            raise
+        
+def srcPath(filename):
+    if topsrcdir is not None:
+        return os.path.join(topsrcdir, filename)
+    return filename
 
 # Initialise the globals.
 pyqt_version = 0x040600
@@ -260,7 +280,7 @@
                 build_file="pyrcc.sbf", dir="pyrcc",
                 install_dir=opts.pyqtbindir, console=1, qt=["QtCore", "QtXml"],
                 debug=opts.debug, warnings=1, universal=sipcfg.universal,
-                arch=sipcfg.arch)
+                topsrcdir=topsrcdir, arch=sipcfg.arch)
 
     def generate_target_default(self, mfile):
         """Generate the default target."""
@@ -357,6 +377,7 @@
         check_module("QAxContainer", "qaxobject.h", "new QAxObject()",
                 extra_libs=["QAxContainer"])
 
+        makeDir("dbus")
         if os.path.isdir("dbus"):
             check_dbus()
 
@@ -474,10 +495,10 @@
 
         # Generate the composite module.
         qtmod_sipdir = os.path.join("sip", "Qt")
-        mk_clean_dir(qtmod_sipdir)
+        mk_clean_dir(srcPath(qtmod_sipdir))
 
         qtmod_sipfile = os.path.join(qtmod_sipdir, "Qtmod.sip")
-        f = open(qtmod_sipfile, "w")
+        f = open(srcPath(qtmod_sipfile), "w")
 
         f.write("""%CompositeModule PyQt4.Qt
 
@@ -589,7 +610,7 @@
 
         mname is the name of the module.
         """
-        qpy_dir = os.path.abspath(os.path.join("qpy", mname))
+        qpy_dir = os.path.join("qpy", mname)
 
         if sys.platform == 'win32':
             if opts.debug:
@@ -599,7 +620,7 @@
         else:
             qpy_lib_dir = qpy_dir
 
-        return qpy_dir, qpy_lib_dir
+        return srcPath(qpy_dir), os.path.abspath(qpy_lib_dir)
 
     def _static_plugins(self, mname):
         """Return a tuple of the libraries (in platform neutral format) and the
@@ -670,7 +691,7 @@
         return libs, libdirs
 
     def module_installs(self):
-        return ["__init__.py", "pyqtconfig.py"]
+        return [srcPath("__init__.py"), "pyqtconfig.py"]
 
     def qpy_libs(self):
         # See which QPy support libraries to build.
@@ -689,8 +710,12 @@
         qmake_args = fix_qmake_args()
         cwd = os.getcwd()
 
+        makeDir("qpy")
+
         for qpy, pro in qpylibs.items():
             sipconfig.inform("Creating QPy support library for %s Makefile..." % qpy)
+            
+            makeDir(os.path.join("qpy", qpy))
 
             os.chdir(os.path.join("qpy", qpy))
 
@@ -721,14 +746,21 @@
             else:
                 pro_config = 'release'
 
+            if topsrcdir:
+                pro = srcPath(os.path.join("qpy", qpy, pro))
+                extra = "VPATH = %s" % (srcPath(os.path.join("qpy", qpy)), )
+                inc_path.append(srcPath(os.path.join("qpy", qpy)))
+            else:
+                extra = ""
+
             f.write(
 """# Tell the original .pro file about additional directories.
 INCLUDEPATH = %s
-
 CONFIG += %s
+%s
 
 include(%s)
-""" % (" ".join(inc_path), pro_config, pro))
+""" % (" ".join(inc_path), pro_config, extra, pro))
 
             f.close()
 
@@ -758,6 +790,7 @@
                 install_dir=pydbusmoddir,
                 qt=["QtCore"],
                 debug=opts.debug,
+                topsrcdir=topsrcdir,
                 universal=sipcfg.universal,
                 arch=sipcfg.arch
             )
@@ -767,18 +800,19 @@
             makefile.generate()
             tool.append("dbus")
 
-        # Only include ElementTree for older versions of Python.
-        if sipcfg.py_version < 0x020500:
-            sipconfig.inform("Creating elementtree Makefile...")
+        # Don't include elementtree on Debian
+##         # Only include ElementTree for older versions of Python.
+##         if sipcfg.py_version < 0x020500:
+##             sipconfig.inform("Creating elementtree Makefile...")
 
-            makefile = sipconfig.PythonModuleMakefile(
-                configuration=sipcfg,
-                dstdir=os.path.join(pyqt_modroot, "elementtree"),
-                dir="elementtree"
-            )
+##             makefile = sipconfig.PythonModuleMakefile(
+##                 configuration=sipcfg,
+##                 dstdir=os.path.join(pyqt_modroot, "elementtree"),
+##                 dir="elementtree"
+##             )
 
-            makefile.generate()
-            tool.append("elementtree")
+##             makefile.generate()
+##             tool.append("elementtree")
 
         # Create the pyuic4 wrapper.  Use the GUI version on MacOS (so that
         # previews work properly and normal console use will work anyway), but
@@ -793,16 +827,18 @@
             use_arch = ''
 
         uicdir=os.path.join(pyqt_modroot, "uic")
-        wrapper = sipconfig.create_wrapper(os.path.join(uicdir, "pyuic.py"), os.path.join("pyuic", "pyuic4"), gui, use_arch)
+        makeDir("pyuic")
+        # Wrapper not needed in Debian
+        #wrapper = sipconfig.create_wrapper(os.path.join(uicdir, "pyuic.py"), os.path.join("pyuic", "pyuic4"), gui, use_arch)
 
         sipconfig.inform("Creating pyuic4 Makefile...")
 
         makefile = sipconfig.PythonModuleMakefile(
             configuration=sipcfg,
             dstdir=uicdir,
-            srcdir="uic",
+            srcdir=srcPath(os.path.join("pyuic", "uic")),
             dir="pyuic",
-            installs=[[os.path.basename(wrapper), opts.pyqtbindir]]
+            #installs=[[os.path.basename(wrapper), opts.pyqtbindir]]
         )
 
         makefile.generate()
@@ -810,7 +846,7 @@
 
         if "QtXml" in pyqt_modules:
             sipconfig.inform("Creating pylupdate4 Makefile...")
-
+            makeDir("pylupdate")
             makefile = sipconfig.ProgramMakefile(
                 configuration=sipcfg,
                 build_file="pylupdate.sbf",
@@ -820,15 +856,17 @@
                 qt=["QtCore", "QtGui", "QtXml"],
                 debug=opts.debug,
                 warnings=1,
+                topsrcdir=topsrcdir,
                 universal=sipcfg.universal,
                 arch=sipcfg.arch
             )
 
+            makefile.extra_include_dirs.append(srcPath("pylupdate"))
             makefile.generate()
             tool.append("pylupdate")
 
             sipconfig.inform("Creating pyrcc4 Makefile...")
-
+            makeDir("pyrcc")
             makefile = pyrccMakefile()
             makefile.generate()
             tool.append("pyrcc")
@@ -868,7 +906,7 @@
                 # Run qmake to generate the Makefile.
                 qmake_args = fix_qmake_args()
                 cwd = os.getcwd()
-                os.chdir("designer")
+                os.chdir(srcPath("designer"))
 
                 # Create the qmake project file.
                 fin = open("python.pro-in")
@@ -895,7 +933,7 @@
                 run_command("%s %s" % (opts.qmake, qmake_args))
                 os.chdir(cwd)
 
-                tool.append("designer")
+                tool.append(srcPath("designer"))
 
         return tool
 
@@ -1061,7 +1099,6 @@
     add_makefile_extras(makefile, extra_include_dirs, extra_lib_dirs, extra_libs)
 
     exe, build = makefile.build_command(name)
-
     # Make sure the executable file doesn't exist.
     remove_file(exe)
     run_command(build)
@@ -1212,7 +1249,7 @@
         return
 
     # Check the module's main .sip file exists.
-    if os.access(os.path.join("sip", mname, mname + "mod.sip"), os.F_OK):
+    if os.access(srcPath(os.path.join("sip", mname, mname + "mod.sip")), os.F_OK):
         sipconfig.inform("Checking to see if the %s module should be built..." % mname)
 
         if check_api(incfile, test, mname, extra_include_dirs=extra_include_dirs, extra_lib_dirs=extra_lib_dirs, extra_libs=extra_libs):
@@ -1423,10 +1460,13 @@
     argv.append(buildfile)
 
     argv.append("-I")
-    argv.append("sip")
+    argv.append(srcPath("sip"))
 
     # SIP assumes POSIX style path separators.
-    argv.append("/".join(["sip", mname, mname + "mod.sip"]))
+    if topsrcdir is not None:
+        argv.append("/".join([topsrcdir, "sip", mname, mname + "mod.sip"]))
+    else:
+        argv.append("/".join(["sip", mname, mname + "mod.sip"]))
 
     cmd = " ".join(argv)
 
@@ -1448,7 +1488,11 @@
         sipfiles = []
 
         for s in glob.glob("sip/" + mname + "/*.sip"):
-            sipfiles.append(os.path.join("..", "sip", mname, os.path.basename(s)))
+            if has_objdir:
+                topdir = topsrcdir
+            else:
+                topdir = ".."
+            sipfiles.append(os.path.join(topdir, "sip", mname, os.path.basename(s)))
 
         installs.append([sipfiles, os.path.join(opts.pyqtsipdir, mname)])
 
@@ -1948,7 +1992,7 @@
     ).generate()
 
     # Install the configuration module.
-    create_config("pyqtconfig.py", "pyqtconfig.py.in", macros)
+    create_config("pyqtconfig.py", srcPath("pyqtconfig.py.in"), macros)
 
 
 ###############################################################################

Reply via email to