[PyQt] How to insert literal $ in QMAKE_LINK_SHLIB_CMD sip spec files

Albert Chin pykde at mlists.thewrittenword.com
Wed Dec 23 17:03:24 GMT 2009


On Wed, Dec 23, 2009 at 10:15:56AM -0600, Albert Chin wrote:
> If I use $${LITERAL_DOLLAR}, I get the following in siplib/Makefile:
> $(TARGET): $(OFILES)
>         @echo '#!' >sip.exp; \
>          echo 'initsip' >>sip.exp
>         rm -f objects.o; ld -r -o objects.o -bnogc ${OFILES}; rm -f lib.exp; /usr/ccs/bin/nm -BCpg objects.o | awk '{ if (((${LITERAL_DOLLAR}2 == "T") || (${LITERAL_DOLLAR}2 == "D") || (${LITERAL_DOLLAR}2 == "B")) && (substr(${LITERAL_DOLLAR}3,1,1) != ".")) { print ${LITERAL_DOLLAR}3 } }' | sort -u >lib.exp; g++ -shared -Wl,-bE:lib.exp -o ${TARGET} ${LFLAGS} objects.o ${LIBS}; rm objects.o

I think the reason this fails is because when you call rhs.find(), you
always start at the beginning of the string, not from the character
after the replacement string. So, when you have two ${LITERAL_DOLLAR}'s
in succession, you get the above. The fix is for successive rhs.find()'s
to begin after the replacement string. Patch attached.

-- 
albert chin (china at thewrittenword.com)
-------------- next part --------------
Index: siputils.py
===================================================================
--- siputils.py.orig	2009-11-23 13:49:24.000000000 +0000
+++ siputils.py	2009-12-23 16:59:42.909683475 +0000
@@ -2337,8 +2358,8 @@
                     value = ""
 
             rhs = rhs[:mstart] + value + rhs[mend:]
-            estart = rhs.find("$$(")
-            mstart = rhs.find("$$")
+            estart = rhs.find("$$(", len (rhs[:mstart] + value))
+            mstart = rhs.find("$$", len (rhs[:mstart] + value))
 
         # Expand any POSIX style environment variables.
         pleadin = ["$$(", "$("]


More information about the PyQt mailing list