[PyKDE] qmake.conf parser bug?

Pavel Volkovitskiy int at mtx.ru
Sat Dec 3 12:15:07 GMT 2005


Hello

I just found than configure.py in sip/pyqt/pykde support this form 
$(FOO) to get FOO from environment
but, according to qt docs ( 
http://doc.trolltech.com/3.3/qmake-manual-6.html ):
> You can also assign the value of a current variable to another 
> variable by prefixing $$ to the variable name. For example:
>     MY_DEFINES = $$DEFINES
>
> Now the MY_DEFINES variable contains what is in the DEFINES variable 
> at this point in the project file. This is also equivalent to:
>  
>     MY_DEFINES = $${DEFINES}
>
> The second notation allows you to adjoin the variable expansion to 
> another value without separating by space. qmake will allow a variable 
> to contain anything (including $(VALUE), which will be placed directly 
> into the Makefile, and allow it to expand as appropriate, usually an 
> environment variable). However, if you require an environment variable 
> to be replaced immediately then you may use the $$() notation. For 
> example:
>     MY_DEFINES = $$(ENV_DEFINES)
>
> This will set MY_DEFINES to the value of the evironment variable 
> ENV_DEFINES as it parses the .pro file.
So, i suggest to apply this patch to configure

-- 
Pavel

-------------- next part --------------
--- configure.py.orig	2005-11-14 20:31:01.000000000 +0300
+++ configure.py	2005-12-03 15:13:17.000000000 +0300
@@ -611,6 +611,28 @@
 
         rhs = raw[lhs]
 
+        # Expand any POSIX style environment variables.
+        estart = string.find(rhs, "$$(")
+
+        while estart >= 0:
+            eend = string.find(rhs[estart + 3:], ")")
+
+            if eend < 0:
+                break
+
+            eend = estart + 3 + eend
+
+            name = rhs[estart + 3:eend]
+
+            try:
+                env = os.environ[name]
+            except KeyError:
+                env = ""
+
+            rhs = rhs[:estart] + env + rhs[eend + 1:]
+
+            estart = string.find(rhs, "$$(")
+
         # Resolve any references.
         mstart = string.find(rhs, "$$")
 
@@ -638,6 +660,7 @@
 
             mstart = string.find(rhs, "$$")
 
+	# TODO: Not sure if it usefull
         # Expand any POSIX style environment variables.
         estart = string.find(rhs, "$(")
 


More information about the PyQt mailing list