(self)
List installed packages and display some informations
List installed packages and display some informations
List installed packages and display some informations
def list_packages(self):
        """ List installed packages and display some informations
        """

        packages = os.listdir(self.pkg_path)

        self.log.info("Domogik release : {0}".format(DMG_VERSION))
        self.log.info("")

        for a_package in packages:
            # this is a directory
            path = os.path.join(self.pkg_path, a_package)
            if os.path.isdir(path):
                try:
                    self.log.info("Package {0} ".format(a_package))
    
                    # try to load json
                    is_ok = self.is_json_ok(json_file = os.path.join(path, JSON_FILE))
                    if is_ok == False:
                        self.log.info("")
                        continue
    
                    # display some informations
                    self.log.info(" - version : {0}".format(self.json['identity']['version']))
    
                    # installation informations
                    if os.path.islink(path):
                        self.log.info(" - install mode : symbolic link to : {0}".format(os.path.realpath(path)))
                    else:
                        self.log.info(" - install mode : folder")

                except:
                    self.log.error("ERROR : {0}".format(traceback.format_exc()))
    
                # add an empty line to be clearer
                self.log.info("")
def list_packages ( self ) : packages = os . listdir ( self . pkg_path ) self . log . info ( "Domogik release : {0}" . format ( DMG_VERSION ) ) self . log . info ( "" ) for a_package in packages : # this is a directory path = os . path . join ( self . pkg_path , a_package ) if os . path . isdir ( path ) : try : self . log . info ( "Package {0} " . format ( a_package ) ) # try to load json is_ok = self . is_json_ok ( json_file = os . path . join ( path , JSON_FILE ) ) if is_ok == False : self . log . info ( "" ) continue # display some informations self . log . info ( " - version : {0}" . format ( self . json [ 'identity' ] [ 'version' ] ) ) # installation informations if os . path . islink ( path ) : self . log . info ( " - install mode : symbolic link to : {0}" . format ( os . path . realpath ( path ) ) ) else : self . log . info ( " - install mode : folder" ) except : self . log . error ( "ERROR : {0}" . format ( traceback . format_exc ( ) ) ) # add an empty line to be clearer self . log . info ( "" )