# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def copytree(src, dst, symlinks=False, ignore=None, replace=True):
#   """
#   this is mostly a copy of shutil.copytree, except it will optionally
#   not barf if target files/directories already exists.
#   """
#   names = os.listdir(src)
#   if ignore is not None:
#     ignored_names = ignore(src, names)
#   else:
#     ignored_names = set()
# 
#   if not replace or not os.path.exists(dst):
#     os.makedirs(dst)
# 
#   errors = []
#   for name in names:
#     if name in ignored_names:
#       continue
#     srcname = os.path.join(src, name)
#     dstname = os.path.join(dst, name)
#     try:
#       if symlinks and os.path.islink(srcname):
#         linkto = os.readlink(srcname) # @UndefinedVariable
#         os.symlink(linkto, dstname)   # @UndefinedVariable 
#       elif os.path.isdir(srcname):
#         copytree(srcname, dstname, symlinks, ignore, replace)
#       else:
#         # Will raise a SpecialFileError for unsupported file types
#         if replace and os.path.exists(dstname):
#           os.unlink(dstname)
#         shutil.copy2(srcname, dstname)
#     # catch the Error from the recursive copytree so that we can
#     # continue with other files
#     except shutil.Error, err:
#       errors.extend(err.args[0])
#     except EnvironmentError, why:
#       errors.append((srcname, dstname, str(why)))
#   try:
#     shutil.copystat(src, dst)
#   except OSError, why:
#     if shutil.WindowsError is not None and isinstance(why, shutil.WindowsError):
#       # Copying file access times may fail on Windows
#       pass
#     else:
#       errors.append((src, dst, str(why)))
#   if errors:
#     raise shutil.Error, errors
# 
# Path: xmlhelp.py
# class Document(minidom.Document):
#   implementation=DOMImplementation()
# 
#   @staticmethod
#   def create(rootName):
#     doc=Document.implementation.createDocument(None, rootName, None)
#     return doc.documentElement
# 
#   @staticmethod
#   def parseRaw(str):
#     doc=minidom.parseString(str)
#     return doc.documentElement
# 
#   @staticmethod
#   def parse(str):
#     doc=Document.implementation.createDocument(None, "none", None)
#     rootRaw=Document.parseRaw(str)
#     root=doc.importNode(rootRaw, True)
#     doc.rootElement=root
#     return root
# 
#   @staticmethod
#   def parseFile(filename):
#     doc=Document.implementation.createDocument(None, "none", None)
#     raw=minidom.parse(filename)
#     root=doc.importNode(raw.documentElement, True)
#     doc.rootElement=root
#     return root
# 
#   def createElement(self, tagName):
#     e=Element(tagName)
#     e.ownerDocument=self
#     return e
# 
#   def createElementNS(self, namespaceURI, qualifiedName):
#     prefix, _localName = minidom._nssplit(qualifiedName)
#     e = Element(qualifiedName, namespaceURI, prefix)
#     e.ownerDocument = self
#     return e


import wx
import requests, sys, os, stat, zipfile, shutil
import adm, logger
import version as admVersion
import time, threading, subprocess
  import Crypto.PublicKey.RSA, Crypto.Hash.SHA, Crypto.Signature.PKCS1_v1_5
from wh import xlt, copytree
from xmlhelp import Document as XmlDocument
            version=admVersion.Version(module.getAttribute('version'))
            if name == "Core":
              info = { 'app': adm.appTitle, 'old': admVersion.version, 'new': version }
              if admVersion.version < version:
                msg.append(xlt("  Core: %(old)s can be updated to %(new)s") % info)
                haveUpdate=True
                self.hasCoreUpdate=True
              elif admVersion.version == version and status > admVersion.revDate:
                msg.append(xlt("  Core: %(new)s minor update.") % info)
                haveUpdate=True
            elif name == "Lib":
              if admVersion.libVersion < version:
                msg=[msg[0], xlt("There is a newer %(app)s Core version %(new)s available.\nHowever, the current version %(old)s can't update online to the new version.\nPlease download and install a full package manually.") % info]
                if not adm.IsPackaged():
                  msg.append(xlt("In addition, the library requirements have changed;\ncheck the new documentation."))
                self.ModuleInfo = "\n".join(msg)
                return False
            else:
              mod=adm.modules.get(name)
              rev=admVersion.Version(mod.moduleinfo.get('revision'))
              if rev:
                info= { 'name': mod.moduleinfo['modulename'], 'old': rev, 'new': version }
                if rev < version:
                  if self.hasCoreUpdate:
                    msg.append(xlt("  %(name)s: %(old)s upgrade to %(new)s") % info)
                  else:
                    msg.append(xlt("Current %(name)s module revision %(old)s can be updated to  %(new)s.") % info)
                    haveUpdate=True
                elif rev > version:
                  if self.hasCoreUpdate:

# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def copytree(src, dst, symlinks=False, ignore=None, replace=True):
#   """
#   this is mostly a copy of shutil.copytree, except it will optionally
#   not barf if target files/directories already exists.
#   """
#   names = os.listdir(src)
#   if ignore is not None:
#     ignored_names = ignore(src, names)
#   else:
#     ignored_names = set()
# 
#   if not replace or not os.path.exists(dst):
#     os.makedirs(dst)
# 
#   errors = []
#   for name in names:
#     if name in ignored_names:
#       continue
#     srcname = os.path.join(src, name)
#     dstname = os.path.join(dst, name)
#     try:
#       if symlinks and os.path.islink(srcname):
#         linkto = os.readlink(srcname) # @UndefinedVariable
#         os.symlink(linkto, dstname)   # @UndefinedVariable 
#       elif os.path.isdir(srcname):
#         copytree(srcname, dstname, symlinks, ignore, replace)
#       else:
#         # Will raise a SpecialFileError for unsupported file types
#         if replace and os.path.exists(dstname):
#           os.unlink(dstname)
#         shutil.copy2(srcname, dstname)
#     # catch the Error from the recursive copytree so that we can
#     # continue with other files
#     except shutil.Error, err:
#       errors.extend(err.args[0])
#     except EnvironmentError, why:
#       errors.append((srcname, dstname, str(why)))
#   try:
#     shutil.copystat(src, dst)
#   except OSError, why:
#     if shutil.WindowsError is not None and isinstance(why, shutil.WindowsError):
#       # Copying file access times may fail on Windows
#       pass
#     else:
#       errors.append((src, dst, str(why)))
#   if errors:
#     raise shutil.Error, errors
# 
# Path: xmlhelp.py
# class Document(minidom.Document):
#   implementation=DOMImplementation()
# 
#   @staticmethod
#   def create(rootName):
#     doc=Document.implementation.createDocument(None, rootName, None)
#     return doc.documentElement
# 
#   @staticmethod
#   def parseRaw(str):
#     doc=minidom.parseString(str)
#     return doc.documentElement
# 
#   @staticmethod
#   def parse(str):
#     doc=Document.implementation.createDocument(None, "none", None)
#     rootRaw=Document.parseRaw(str)
#     root=doc.importNode(rootRaw, True)
#     doc.rootElement=root
#     return root
# 
#   @staticmethod
#   def parseFile(filename):
#     doc=Document.implementation.createDocument(None, "none", None)
#     raw=minidom.parse(filename)
#     root=doc.importNode(raw.documentElement, True)
#     doc.rootElement=root
#     return root
# 
#   def createElement(self, tagName):
#     e=Element(tagName)
#     e.ownerDocument=self
#     return e
# 
#   def createElementNS(self, namespaceURI, qualifiedName):
#     prefix, _localName = minidom._nssplit(qualifiedName)
#     e = Element(qualifiedName, namespaceURI, prefix)
#     e.ownerDocument = self
#     return e


# Path: Update.py
import wx
import requests, sys, os, stat, zipfile, shutil
import adm, logger
import version as admVersion
import time, threading, subprocess
  import Crypto.PublicKey.RSA, Crypto.Hash.SHA, Crypto.Signature.PKCS1_v1_5
from wh import xlt, copytree
from xmlhelp import Document as XmlDocument

            version=admVersion.Version(module.getAttribute('version'))
            if name == "Core":
              info = { 'app': adm.appTitle, 'old': admVersion.version, 'new': version }
              if admVersion.version < version:
                msg.append(xlt("  Core: %(old)s can be updated to %(new)s") % info)
                haveUpdate=True
                self.hasCoreUpdate=True
              elif admVersion.version == version and status > admVersion.revDate:
                msg.append(xlt("  Core: %(new)s minor update.") % info)
                haveUpdate=True
            elif name == "Lib":
              if admVersion.libVersion < version:
                msg=[msg[0], xlt("There is a newer %(app)s Core version %(new)s available.\nHowever, the current version %(old)s can't update online to the new version.\nPlease download and install a full package manually.") % info]
                if not adm.IsPackaged():
                  msg.append(xlt("In addition, the library requirements have changed;\ncheck the new documentation."))
                self.ModuleInfo = "\n".join(msg)
                return False
            else:
              mod=adm.modules.get(name)
              rev=admVersion.Version(mod.moduleinfo.get('revision'))
              if rev:
                info= { 'name': mod.moduleinfo['modulename'], 'old': rev, 'new': version }
                if rev < version:
                  if self.hasCoreUpdate:
                    msg.append(xlt("  %(name)s: %(old)s upgrade to %(new)s") % info)
                  else:
                    msg.append(xlt("Current %(name)s module revision %(old)s can be updated to  %(new)s.") % info)
                    haveUpdate=True
                elif rev > version:
                  if self.hasCoreUpdate:

                    msg.append(xlt("  %(name)s: %(old)s DOWNGRADE to %(new)s, please check") % info)