Example #1
0
def FindFilesAndBuildFileList(sdir, fileInfoList, init=True):
    """
    Recursively scans the source directory specified for relevant files according
    to the file extensions configured in metaInfo, while excluding RCS
    directories (see rcsnames in configuration section FileNames). Information
    for matching files is stored in fileInfoList.
    @param string sdir directory to scan
    @param list fileInfoList where to store results
    """
    from parsers.filefinder import getFileList
    printProgress(_("Creating file list"), logName)

    # setup wanted file extensions
    fileExts = [('sql',metaInfo.sql_file_exts),('cpp',metaInfo.cpp_file_exts)]
    if metaInfo.indexPage['form'] != '': fileExts.append(('xml',['xml']))

    # retrieve the list
    fileInfoList += getFileList(sdir,fileExts,metaInfo.rcsnames,metaInfo.ignorefile)
    cpos  = len(sdir)
    if sdir[cpos-1] != os.sep: cpos += 1

    # some adjustments are required
    for f in fileInfoList:
        f.uniqueName = f.fileName[cpos:].replace('.','_').replace(os.path.sep,'--') # unique Name (for new-style refs)
        if f.uniqueNumber == 0: f.uniqueNumber = metaInfo.NextIndex()       # unique Number (old style, deprecated)
Example #2
0
def FindFilesAndBuildFileList(sdir, fileInfoList, init=True):
    """
    Recursively scans the source directory specified for relevant files according
    to the file extensions configured in metaInfo, while excluding RCS
    directories (see rcsnames in configuration section FileNames). Information
    for matching files is stored in fileInfoList.
    @param string sdir directory to scan
    @param list fileInfoList where to store results
    """
    from parsers.filefinder import getFileList
    printProgress(_("Creating file list"), logName)

    # setup wanted file extensions
    fileExts = [('sql',metaInfo.sql_file_exts),('cpp',metaInfo.cpp_file_exts)]
    if metaInfo.indexPage['form'] != '': fileExts.append(('xml',['xml']))

    # retrieve the list
    fileInfoList += getFileList(sdir,fileExts,metaInfo.rcsnames)
    cpos  = len(sdir)
    if sdir[cpos-1] != os.sep: cpos += 1

    # some adjustments are required
    for f in fileInfoList:
        f.uniqueName = f.fileName[cpos:].replace('.','_').replace('/','--') # unique Name (for new-style refs)
        if f.uniqueNumber == 0: f.uniqueNumber = metaInfo.NextIndex()       # unique Number (old style, deprecated)
Example #3
0
        else: print 'specified config file %s not found' % metaInfo.cmdOpts.config
    if len(confName)==0:
        for proj in ['HyperSQL','hypersql']:
            pfile = os.path.join(metaInfo.scriptpath, proj) + '.ini'
            if not pfile in confName and os.path.exists(pfile):
                confName.append(pfile)
        if len(metaInfo.cmdArgs)>0:
            for proj in [metaInfo.cmdArgs[0].lower(),metaInfo.cmdArgs[0]]:
                pfile = os.path.join(metaInfo.scriptpath, proj) + '.ini'
                if not pfile in confName and os.path.exists(pfile):
                    confName.append(pfile)
    # If we have any config files, read them!
    if len(confName) > 0:
      config.read(confName)
    elif not metaInfo.cmdOpts.quiet and not metaInfo.cmdOpts.cron and (metaInfo.cmdOpts.progress is None or metaInfo.cmdOpts.progress):
      print _('No config file found, using defaults.')

    configRead()
    confDeps()

    # Initiate logging
    if metaInfo.printProgress: from progress import *
    confLogger()
    from hypercore.logger import logg
    logger = logg.getLogger()
    printProgress(_('HyperSQL v%s initialized') % metaInfo.versionString, logName)
    logger.debug('ScriptName: '+metaInfo.scriptName)

    if len(confName) > 0:
      logger.info(_('Using config file(s) ') + ', '.join(confName))
    else:
Example #4
0
    if len(confName)==0:
        metaInfo.scriptpath = os.path.split(sys.argv[0])[0]
        for proj in ['HyperSQL','hypersql']:
            pfile = os.path.join(metaInfo.scriptpath, proj) + '.ini'
            if not pfile in confName and os.path.exists(pfile):
                confName.append(pfile)
        if len(metaInfo.cmdArgs)>0:
            for proj in [metaInfo.cmdArgs[0].lower(),metaInfo.cmdArgs[0]]:
                pfile = os.path.join(metaInfo.scriptpath, proj) + '.ini'
                if not pfile in confName and os.path.exists(pfile):
                    confName.append(pfile)
    # If we have any config files, read them!
    if len(confName) > 0:
      config.read(confName)
    elif not metaInfo.cmdOpts.quiet and not metaInfo.cmdOpts.cron and (metaInfo.cmdOpts.progress is None or metaInfo.cmdOpts.progress):
      print _('No config file found, using defaults.')

    configRead()
    confDeps()

    # Initiate logging
    if metaInfo.printProgress: from progress import *
    confLogger()
    from hypercore.logger import logg
    logger = logg.getLogger()
    printProgress(_('HyperSQL v%s initialized') % metaInfo.versionString, logName)
    logger.debug('ScriptName: '+metaInfo.scriptName)

    if len(confName) > 0:
      logger.info(_('Using config file(s) ') + ', '.join(confName))
    else: