On 12/07/2007 1.45, Martin Blais wrote:

I created a page with all the details on how to build PyQt4 for Windows, here:
http://www.diotavelli.net/PyQtWiki/BuildPyQt4Windows

And I propose the attached patch, which clarifies the error messages (especially the message displayed when the first "make" compilation fails) and disable "-q" under Windows (where it does not work anyway).

Sample session with the patch:

[E:\pyqt\PyQt-win-gpl-4-snapshot-20070710]configure.py
Determining the layout of your Qt installation...
Error: Make sure you have a working Qt v4 qmake on your PATH

[E:\pyqt\PyQt-win-gpl-4-snapshot-20070710]set PATH=e:\Qt\4.3.0\bin\;%PATH%

[E:\pyqt\PyQt-win-gpl-4-snapshot-20070710]configure.py
Determining the layout of your Qt installation...
Error: Failed to create release\qtdirs.exe (using platform: win32-msvc.net).
Make sure your compiler is installed correctly and you have a working "nmake"
on your PATH

[E:\pyqt\PyQt-win-gpl-4-snapshot-20070710]vc71
"C:\Programmi\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)

[E:\pyqt\PyQt-win-gpl-4-snapshot-20070710]configure.py
Determining the layout of your Qt installation...
This is the GPL version of PyQt 4-snapshot-20070710 (licensed under the GNU
General Public License) for Python 2.4.2 on win32.
[
...
...
...
...
]

--
Giovanni Bajo

--- configure.py.old	2007-07-11 03:44:24.000000000 +0200
+++ configure.py	2007-07-12 02:20:03.512947200 +0200
@@ -62,6 +62,11 @@
 dbuslibdirs = []
 dbuslibs = []
 
+if os.name == "nt":
+    MSG_CHECK_QMAKE = "Make sure you have a working Qt v4 qmake on your PATH"
+else:
+    MSG_CHECK_QMAKE = "Make sure you have a working Qt v4 qmake on your PATH or use the -q argument to explicitly specify a working Qt v4 qmake."
+
 
 def find_default_qmake():
     """Find a default qmake, ie. the first on the path.
@@ -135,9 +140,10 @@
     g.add_option("-t", "--plugin", action="append", default=[],
             metavar="PLUGIN", dest="staticplugins", help="add PLUGIN to the "
             "list be linked (if Qt is built as static libraries)")
-    g.add_option("-q", "--qmake", action="callback", metavar="FILE",
-            default=qmake, callback=store_abspath_file, type="string",
-            help="the pathname of qmake [default: %s]" % (qmake or "none"))
+    if os.name != "nt":
+        g.add_option("-q", "--qmake", action="callback", metavar="FILE",
+                default=qmake, callback=store_abspath_file, type="string",
+                help="the pathname of qmake [default: %s]" % (qmake or "none"))
     g.add_option("-s", "--dbus", action="callback", metavar="DIR",
             dest="pydbusincdir", callback=store_abspath_dir, type="string",
             help="the directory containing the dbus/dbus-python.h header file "
@@ -1474,8 +1480,13 @@
     """
     sipconfig.inform("Determining the layout of your Qt installation...")
 
+    if os.name == "nt":
+        # Under Windows, qmake (and Qt) must be into the system PATH.
+        # Otherwise, the dynamic linker won't be able to resolve the symbols.
+        opts.qmake = find_default_qmake()
+    
     if not opts.qmake:
-        sipconfig.error("Make sure you have a working Qt v4 qmake on your PATH or use the -q argument to explicitly specify a working Qt v4 qmake.")
+        sipconfig.error(MSG_CHECK_QMAKE)
 
     # The file names we will use to get the directory information.
     app = "qtdirs"
@@ -1574,7 +1585,7 @@
     run_command("%s %s %s" % (opts.qmake, qmake_args, pro_file))
 
     if not os.access(make_file, os.F_OK):
-        sipconfig.error("%s failed to create a makefile. Make sure you have a working Qt v4 qmake on your PATH or use the -q argument to explicitly specify a working Qt v4 qmake." % opts.qmake)
+        sipconfig.error(("%s failed to create a makefile. " + MSG_CHECK_QMAKE) % opts.qmake)
 
     # Try and work out the name of make.
     if sipcfg.platform.startswith("win32-msvc"):
@@ -1591,7 +1602,7 @@
     run_command("%s -f %s%s" % (make, make_file, make_target))
 
     if not os.access(exe_file, os.X_OK):
-        sipconfig.error("Failed to create %s. Make sure you have a working Qt v4 qmake on your PATH or use the -q argument to explicitly specify a working Qt v4 qmake." % exe_file)
+        sipconfig.error("Failed to create %s (using platform: %s). Make sure your compiler is installed correctly and you have a working \"%s\" on your PATH" % (exe_file, sipcfg.platform, make))
 
     # Create the output file, first making sure it doesn't exist.
     remove_file(out_file)
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to