def __importTemple( self, temple, project, override = False ): fqueue = Queue( 0, [ temple ] ) temple = altsep( temple ) project= altsep( project ) while True: if fqueue.empty(): break src_dir = altsep( fqueue.get() ) des_dir = src_dir.replace( temple, project ) items = os.listdir( src_dir ) message( "directory:" + src_dir, c = DEBUG ) for item in items: src = os.path.join( src_dir, item ) des = os.path.join( des_dir, item ) message( "file: " + src, c = DEBUG ) if os.path.isdir( src ): if not os.path.isdir( des ): os.makedirs( des ) message( "create directory: " + des, c = DEBUG ) fqueue.put( src ) else: if not os.path.isfile( des ) or override: shutil.copy2( src, des ) message( "copy file: " + src, c = DEBUG ) else: message( "ignore file:" + src, c = DEBUG )
def __getTempleList( self ): directory = CFG.get( "temple_dir" ) items = os.listdir( directory ) self.__templist = [] for item in items: path = altsep( os.path.join( directory, item ) ) if os.path.isdir( path ): self.__templist.append( path )