X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8994c3c20cae2b27f479fefe8d4190d9bffb8cad..f78e4942ec0f3f6abd2992502e2d6c5c2e8e55f6:/wxPython/distrib/build_renamers.py diff --git a/wxPython/distrib/build_renamers.py b/wxPython/distrib/build_renamers.py index 022051b8dc..e99acb3a8f 100755 --- a/wxPython/distrib/build_renamers.py +++ b/wxPython/distrib/build_renamers.py @@ -122,7 +122,9 @@ def main(args): # blow away the old one if they are different. for dest, temp in [(swigDest, swigDestTemp), (pyDest, pyDestTemp)]: - if open(dest).read() != open(temp).read(): + if not os.path.exists(dest): + os.rename(temp, dest) + elif open(dest).read() != open(temp).read(): os.unlink(dest) os.rename(temp, dest) else: @@ -134,7 +136,7 @@ def main(args): def GetAttr(node, name): path = "./attributelist/attribute[@name='%s']/@value" % name - n = node.xpathEval(path) + n = node.xpathEval2(path) if len(n): return n[0].content else: @@ -148,7 +150,7 @@ def processXML(xmlfile, modname, swigFile, pyFile): topnode = libxml2.parseFile(xmlfile).children # remove any import nodes as we don't need to do renamers for symbols found therein - imports = topnode.xpathEval("*/import") + imports = topnode.xpathEval2("*/import") for n in imports: n.unlinkNode() n.freeNode() @@ -211,7 +213,7 @@ def processXML(xmlfile, modname, swigFile, pyFile): addWX = True - if doRename: + if doRename and name: old = new = name if old.startswith('wx') and not old.startswith('wxEVT_'): # remove all wx prefixes except wxEVT_ and write a %rename directive for it