parameters: (self)
docstring: Common installation steps of the repository.
docstring_summary: Common installation steps of the repository.
docstring_tokens: Common installation steps of the repository .
function: async def async_install_repository(self) -> None:
          """Common installation steps of the repository."""
          persistent_directory = None
          await self.update_repository(force=True)
          if self.content.path.local is None:
              raise HacsException("repository.content.path.local is None")
          self.validate.errors.clear()
  
          if not self.can_download:
              raise HacsException("The version of Home Assistant is not compatible with this version")
  
          version = version_to_download(self)
          if version == self.data.default_branch:
              self.ref = version
          else:
              self.ref = f"tags/{version}"
  
          if self.data.installed and self.data.category == "netdaemon":
              persistent_directory = BackupNetDaemon(hacs=self.hacs, repository=self)
              await self.hacs.hass.async_add_executor_job(persistent_directory.create)
  
          elif self.data.persistent_directory:
              if os.path.exists(f"{self.content.path.local}/{self.data.persistent_directory}"):
                  persistent_directory = Backup(
                      hacs=self.hacs,
                      local_path=f"{self.content.path.local}/{self.data.persistent_directory}",
                      backup_path=tempfile.gettempdir() + "/hacs_persistent_directory/",
                  )
                  await self.hacs.hass.async_add_executor_job(persistent_directory.create)
  
          if self.data.installed and not self.content.single:
              backup = Backup(hacs=self.hacs, local_path=self.content.path.local)
              await self.hacs.hass.async_add_executor_job(backup.create)
  
          self.hacs.log.debug("%s Local path is set to %s", self, self.content.path.local)
          self.hacs.log.debug("%s Remote path is set to %s", self, self.content.path.remote)
  
          if self.data.zip_release and version != self.data.default_branch:
              await self.download_zip_files(self.validate)
          else:
              await self.download_content()
  
          if self.validate.errors:
              for error in self.validate.errors:
                  self.logger.error(error)
              if self.data.installed and not self.content.single:
                  await self.hacs.hass.async_add_executor_job(backup.restore)
  
          if self.data.installed and not self.content.single:
              await self.hacs.hass.async_add_executor_job(backup.cleanup)
  
          if persistent_directory is not None:
              await self.hacs.hass.async_add_executor_job(persistent_directory.restore)
              await self.hacs.hass.async_add_executor_job(persistent_directory.cleanup)
  
          if self.validate.success:
              self.data.installed = True
              self.data.installed_commit = self.data.last_commit
  
              if version == self.data.default_branch:
                  self.data.installed_version = None
              else:
                  self.data.installed_version = version
function_tokens: async def async_install_repository ( self ) -> None : persistent_directory = None await self . update_repository ( force = True ) if self . content . path . local is None : raise HacsException ( "repository.content.path.local is None" ) self . validate . errors . clear ( ) if not self . can_download : raise HacsException ( "The version of Home Assistant is not compatible with this version" ) version = version_to_download ( self ) if version == self . data . default_branch : self . ref = version else : self . ref = f"tags/{version}" if self . data . installed and self . data . category == "netdaemon" : persistent_directory = BackupNetDaemon ( hacs = self . hacs , repository = self ) await self . hacs . hass . async_add_executor_job ( persistent_directory . create ) elif self . data . persistent_directory : if os . path . exists ( f"{self.content.path.local}/{self.data.persistent_directory}" ) : persistent_directory = Backup ( hacs = self . hacs , local_path = f"{self.content.path.local}/{self.data.persistent_directory}" , backup_path = tempfile . gettempdir ( ) + "/hacs_persistent_directory/" , ) await self . hacs . hass . async_add_executor_job ( persistent_directory . create ) if self . data . installed and not self . content . single : backup = Backup ( hacs = self . hacs , local_path = self . content . path . local ) await self . hacs . hass . async_add_executor_job ( backup . create ) self . hacs . log . debug ( "%s Local path is set to %s" , self , self . content . path . local ) self . hacs . log . debug ( "%s Remote path is set to %s" , self , self . content . path . remote ) if self . data . zip_release and version != self . data . default_branch : await self . download_zip_files ( self . validate ) else : await self . download_content ( ) if self . validate . errors : for error in self . validate . errors : self . logger . error ( error ) if self . data . installed and not self . content . single : await self . hacs . hass . async_add_executor_job ( backup . restore ) if self . data . installed and not self . content . single : await self . hacs . hass . async_add_executor_job ( backup . cleanup ) if persistent_directory is not None : await self . hacs . hass . async_add_executor_job ( persistent_directory . restore ) await self . hacs . hass . async_add_executor_job ( persistent_directory . cleanup ) if self . validate . success : self . data . installed = True self . data . installed_commit = self . data . last_commit if version == self . data . default_branch : self . data . installed_version = None else : self . data . installed_version = version