--- xml2po/xml2po/modes/docbook.py.orig 2011-01-11 03:08:10.000000000 +1100 +++ xml2po/xml2po/modes/docbook.py 2022-01-15 17:32:25.000000000 +1100 @@ -37,13 +37,8 @@ import libxml2 import os import sys -try: - # Hashlib is new in Python 2.5 - from hashlib import md5 as md5_new -except ImportError: - from md5 import new as md5_new - -from basic import basicXmlMode +from hashlib import md5 as md5_new +from .basic import basicXmlMode class docbookXmlMode(basicXmlMode): """Class for special handling of DocBook document types. @@ -131,7 +126,7 @@ hash = self._md5_for_file(fullpath) else: hash = "THIS FILE DOESN'T EXIST" - print >>sys.stderr, "Warning: image file '%s' not found." % fullpath + print("Warning: image file '%s' not found." % fullpath, file=sys.stderr) msg.outputMessage("@@image: '%s'; md5=%s" % (attr, hash), node.lineNo(), "When image changes, this message will be marked fuzzy or untranslated for you.\n"+ @@ -184,7 +179,7 @@ else: ai.addChild(copy) if match.group(3): - copy.newChild(None, "year", match.group(3).encode('utf-8')) + copy.newChild(None, "year", match.group(3)) # .encode('utf-8')) if match.group(1) and match.group(2): holder = match.group(1)+"(%s)" % match.group(2) elif match.group(1): @@ -193,15 +188,14 @@ holder = match.group(2) else: holder = "???" - copy.newChild(None, "holder", holder.encode('utf-8')) + copy.newChild(None, "holder", holder) # .encode('utf-8')) # Perform some tests when ran standalone if __name__ == '__main__': test = docbookXmlMode() - print "Ignored tags : " + repr(test.getIgnoredTags()) - print "Final tags : " + repr(test.getFinalTags()) - print "Space-preserve tags: " + repr(test.getSpacePreserveTags()) - - print "Credits from string: '%s'" % test.getStringForTranslators() - print "Explanation for credits:\n\t'%s'" % test.getCommentForTranslators() + print("Ignored tags : " + repr(test.getIgnoredTags())) + print("Final tags : " + repr(test.getFinalTags())) + print("Space-preserve tags: " + repr(test.getSpacePreserveTags())) + print("Credits from string: '%s'" % test.getStringForTranslators()) + print("Explanation for credits:\n\t'%s'" % test.getCommentForTranslators())