[A-A-P-develop] An alternative to sufreplace
Brought to you by:
vimboss
From: Adriaan de G. <ad...@cs...> - 2003-08-16 08:59:25
|
The attached patch adds suffixmangle() to the library of AAP-specific Python functions. It acts like a kind of list-lifted sufreplace() - you give it a list of replacements and it does them. The calling form is suffixmangle(recdict,variablename,replacementlist) typically, recdict will be _recipe when calling suffixmangle. variablename is the _name_ of a variable - not it's value. So use "source", not source, when calling this. Actually, I don't even know if "source" is in there - use "SOURCES", or whatever you named the variable that stores the list of interesting files, instead. replacementlist is a list of pairs (suffix,new suffix), and if a suffix matches, that suffix is replaced by the new suffix. The first match wins. Possible use is, say, to deal with "fake sources", or to change some filenames on the way: suffixmangle(_recipe,"SOURCES",[ (".y","_"+OSNAME+".y") ]) this would replace all .y by _OSNAME.y in your list of sources, which would let you list one source name but have it replaced at AAP runtime by another. A previous version I mentioned removed attributes. As Bram pointed out, using var2dictlist fixes that. This version preserves attributes. -- pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <gr...@kd...> Key fingerprint = 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE |