コード例 #1
0
 def download_complete(self, location):
     """Called when the file is done downloading, and MD5 has been successfull"""
     logging.debug("Download complete.")
     zippy = ZipFile(location, mode='r')
     extracted_path = os.path.join(self.save_directory,
                                   os.path.basename(location).strip(".zip"))
     zippy.extractall(extracted_path, pwd=self.password)
     bootstrapper_path = os.path.join(
         self.save_directory,
         self.bootstrapper)  #where we will find our bootstrapper
     old_bootstrapper_path = os.path.join(extracted_path, self.bootstrapper)
     if os.path.exists(bootstrapper_path):
         os.chmod(bootstrapper_path, 666)
         os.remove(bootstrapper_path)
     shutil.move(old_bootstrapper_path,
                 self.save_directory)  #move bootstrapper
     os.chmod(bootstrapper_path, stat.S_IRUSR | stat.S_IXUSR)
     bootstrapper_command = r'%s' % bootstrapper_path
     bootstrapper_args = r'"%s" "%s" "%s" "%s"' % (
         os.getpid(), extracted_path, self.app_path, self.postexecute)
     win32api.ShellExecute(0, 'open', bootstrapper_command,
                           bootstrapper_args, "", 5)
     self.complete = 1
     if callable(self.finish_callback):
         self.finish_callback()
コード例 #2
0
ファイル: updater.py プロジェクト: Oire/TWBlue
 def download_complete(self, location):
  """Called when the file is done downloading, and MD5 has been successfull"""
  logger.debug("Download complete.")
  zippy = ZipFile(location, mode='r')
  extracted_path = os.path.join(self.save_directory, os.path.basename(location).strip(".zip"))
  zippy.extractall(extracted_path, pwd=self.password)
  bootstrapper_path = os.path.join(self.save_directory, self.bootstrapper) #where we will find our bootstrapper
  old_bootstrapper_path = os.path.join(extracted_path, self.bootstrapper)
  if os.path.exists(bootstrapper_path):
   os.chmod(bootstrapper_path, 666)
   os.remove(bootstrapper_path)
  shutil.move(old_bootstrapper_path, self.save_directory) #move bootstrapper
  os.chmod(bootstrapper_path, stat.S_IRUSR|stat.S_IXUSR)
  if platform.system() == "Windows": 
   bootstrapper_command = r'%s' % bootstrapper_path
   bootstrapper_args = r'"%s" "%s" "%s" "%s"' % (os.getpid(), extracted_path, self.app_path, self.postexecute)
   win32api.ShellExecute(0, 'open', bootstrapper_command, bootstrapper_args, "", 5)
  else:
   #bootstrapper_command = [r'sh "%s" -l "%s" -d "%s" "%s"' % (bootstrapper_path, self.app_path, extracted_path, str(os.getpid()))]
   bootstrapper_command = r'"%s" "%s" "%s" "%s" "%s"' % (bootstrapper_path, os.getpid(), extracted_path, self.app_path, self.postexecute)
   shell = True
   #logging.debug("Final bootstrapper command: %r" % bootstrapper_command)
   subprocess.Popen([bootstrapper_command], shell=shell)
  self.complete = 1
  if callable(self.finish_callback):
   self.finish_callback()