(self)
Common installation steps of the repository.
Common installation steps of the repository.
Common installation steps of the repository .
async def install(self):
        """Common installation steps of the repository."""
        self.validate.errors = []

        await self.update_repository()

        if self.status.installed and not self.content.single:
            backup = Backup(self.content.path.local)
            backup.create()

        validate = await self.download_content(
            self.validate, self.content.path.remote, self.content.path.local, self.ref
        )

        if validate.errors:
            for error in validate.errors:
                self.logger.error(error)
            if self.status.installed and not self.content.single:
                backup.restore()

        if self.status.installed and not self.content.single:
            backup.cleanup()

        if validate.success:
            if self.information.full_name not in self.common.installed:
                if self.information.full_name != "custom-components/hacs":
                    self.common.installed.append(self.information.full_name)
            self.status.installed = True
            self.versions.installed_commit = self.versions.available_commit

            if self.status.selected_tag is not None:
                self.versions.installed = self.status.selected_tag
            else:
                self.versions.installed = self.versions.available

            if self.information.category == "integration":
                if (
                    self.config_flow
                    and self.information.full_name != "custom-components/hacs"
                ):
                    await self.reload_custom_components()
                else:
                    self.pending_restart = True
async def install ( self ) : self . validate . errors = [ ] await self . update_repository ( ) if self . status . installed and not self . content . single : backup = Backup ( self . content . path . local ) backup . create ( ) validate = await self . download_content ( self . validate , self . content . path . remote , self . content . path . local , self . ref ) if validate . errors : for error in validate . errors : self . logger . error ( error ) if self . status . installed and not self . content . single : backup . restore ( ) if self . status . installed and not self . content . single : backup . cleanup ( ) if validate . success : if self . information . full_name not in self . common . installed : if self . information . full_name != "custom-components/hacs" : self . common . installed . append ( self . information . full_name ) self . status . installed = True self . versions . installed_commit = self . versions . available_commit if self . status . selected_tag is not None : self . versions . installed = self . status . selected_tag else : self . versions . installed = self . versions . available if self . information . category == "integration" : if ( self . config_flow and self . information . full_name != "custom-components/hacs" ) : await self . reload_custom_components ( ) else : self . pending_restart = True