示例#1
0
    def gatherComponents(self):
        """
		This Method Gather The Components.
		"""

        if self.paths:
            self._components = {}
            walker = Walker()
            for path in self.paths.keys():
                walker.root = self.paths[path]
                walker.walk(("\.{0}$".format(self._extension),), ("\._",))
                for component in walker.files.keys():
                    LOGGER.debug("> Current Component : '{0}'.".format(component))
                    profile = self.getProfile(walker.files[component])
                    if profile:
                        if os.path.isfile(os.path.join(profile.path, profile.module) + ".py"):
                            self._components[profile.name] = profile
                        else:
                            LOGGER.warning(
                                "!> {0} | '{1}' Has No Associated Module And Has Been Rejected !".format(
                                    self.__class__.__name__, component
                                )
                            )
                            continue
                    else:
                        LOGGER.warning(
                            "!> {0} | '{1}' Is Not A Valid Component And Has Been Rejected !".format(
                                self.__class__.__name__, component
                            )
                        )
        else:
            raise foundations.exceptions.ProgrammingError("'{0}' Has No Components Paths Defined !".format(self))
示例#2
0
	def scanSetsDirectories( self ):
		'''
		This Method Scans Sets Directories.
		'''

		LOGGER.info( "{0} | Scanning Sets Directories For New Sets !".format( self.__class__.__name__ ) )

		self._newIblSets = {}
		paths = [path[0] for path in self._dbSession.query( dbUtilities.types.DbSet.path ).all()]
		folders = set( [os.path.normpath( os.path.join( os.path.dirname( path ), ".." ) ) for path in paths] )
		needModelRefresh = False
		for folder in folders :
			if os.path.exists( folder ):
				walker = Walker( folder )
				walker.walk( ( "\.{0}$".format( self._extension ), ), ( "\._", ) )
				for iblSet, path in walker.files.items() :
					if not dbUtilities.common.filterSets( self._dbSession, "^{0}$".format( re.escape( path ) ), "path" ) :
						needModelRefresh = True
						self._newIblSets[iblSet] = path
			else:
				LOGGER.warning( "!> '{0}' Folder Doesn't Exists And Can't Be Scanned For New Sets !".format( folder ) )

		self._dbSession.close()

		LOGGER.info( "{0} | Scanning Done !".format( self.__class__.__name__ ) )

		needModelRefresh and self.emit( SIGNAL( "databaseChanged()" ) )
def getTemplatesReleases():
	'''
	This Definition Gets Templates Releases.
	'''

	walker = Walker()
	walker.root = TEMPLATES_PATH
	templates = walker.walk( ( TEMPLATES_EXTENSION, ), ( "\._", ) )
	for template in sorted( templates.keys() ) :
		parser = Parser( templates[template] )
		parser.read() and parser.parse()

		LOGGER.info( "{0} | '{1}' : '{2}' !".format( getTemplatesReleases.__name__, template, foundations.parser.getAttributeCompound( "Release", parser.getValue( "Release", "Template", encode = True ) ).value ) )