예제 #1
0
파일: Export.py 프로젝트: kmixter/regal
    def __init__(self):

        parser = OptionParser()
        parser.add_option('-a',
                          '--api',
                          dest='apis',
                          metavar='API VERSION',
                          action='append',
                          nargs=2,
                          help='generate loader for API and VERSION')
        parser.add_option('-c',
                          '--copyright',
                          dest='copyright',
                          action='store_true',
                          help='include copyright notice')
        parser.add_option('--outdir',
                          dest='outdir',
                          metavar='DIR',
                          help='output directory')
        parser.set_defaults(apis=[])
        (options, args) = parser.parse_args()

        if not len(options.apis):
            parser.error('Specify an api.\n  See Export.py --help')

        apis = []
        for apiItem in options.apis:

            # Some fakery for gles - use the gl database

            if apiItem[0] == 'gles':
                api = deepcopy(importAttr('gl'))
                api.name = 'gles'
            else:
                api = importAttr(apiItem[0])

            api.version = float(apiItem[1])
            api.name = '%s' % apiItem[0]
            apis.append(api)

        class Args(object):
            pass

        genArgs = Args()

        genArgs.copyright = ''
        if options.copyright:
            genArgs.copyright = copyrightMessage

        genArgs.license = regalLicense
        genArgs.generated = autoGeneratedMessage
        genArgs.outdir = options.outdir.strip()

        generate(apis, genArgs)
예제 #2
0
파일: Export.py 프로젝트: Solexid/regal
def main():

    parser = OptionParser()
    parser.add_option('-a', '--api',       dest = 'apis',      metavar = 'API VERSION', action = 'append', nargs = 2, help = 'generate loader for API and VERSION')
    parser.add_option('-c', '--copyright', dest = 'copyright',                          action = 'store_true',        help = 'include copyright notice')
    parser.add_option(      '--outdir',    dest = 'outdir',    metavar = 'DIR',                                       help = 'output directory')
    parser.set_defaults(apis = [])
    (options, args) = parser.parse_args()

    if not len(options.apis):
      parser.error('Specify an api.\n  See Export.py --help')

    if not options.outdir:
      parser.error('Specify output directory.\n  See Export.py --help')

    apis = []
    for apiItem in options.apis:

      # Some fakery for gles - use the gl database

      if apiItem[0]=='gles':
        api = deepcopy(importAttr('gl'))
        api.name = 'gles'
      else:
        api = importAttr(apiItem[0])

      api.version = float(apiItem[1])
      api.name = '%s' % apiItem[0]
      apis.append(api)

    class Args(object) : pass
    genArgs = Args()

    genArgs.copyright = ''
    if options.copyright:
      genArgs.copyright = copyrightMessage

    genArgs.license   = regalLicense
    genArgs.generated = autoGeneratedMessage
    genArgs.srcdir    = options.outdir + '/src/regal'
    genArgs.testdir   = options.outdir + '/tests'
    genArgs.incdir    = options.outdir + '/include/GL'

    for path in (genArgs.incdir, genArgs.srcdir):
      if not os.path.exists(path):
        os.makedirs(path)
        print 'Directory created: %s' % path

    generate(apis, genArgs)
예제 #3
0
  def __init__(self):

    parser = OptionParser()
    parser.add_option('-a', '--api',       dest = 'apis',      metavar = 'API VERSION', action = 'append', nargs = 2, help = 'generate loader for API and VERSION')
    parser.add_option('-c', '--copyright', dest = 'copyright',                          action = 'store_true',        help = 'include copyright notice')
    parser.add_option(      '--outdir',    dest = 'outdir',    metavar = 'DIR',                                       help = 'output directory')
    parser.set_defaults(apis = [])
    (options, args) = parser.parse_args()

    if not len(options.apis):
      parser.error('Specify an api.\n  See Export.py --help')

    apis = []
    for apiItem in options.apis:

      # Some fakery for gles - use the gl database

      if apiItem[0]=='gles':
        api = deepcopy(importAttr('gl'))
        api.name = 'gles'
      else:
        api = importAttr(apiItem[0])

      api.version = float(apiItem[1])
      api.name = '%s' % apiItem[0]
      apis.append(api)

    class Args(object) : pass
    genArgs = Args()

    genArgs.copyright = ''
    if options.copyright:
      genArgs.copyright = copyrightMessage

    genArgs.license   = regalLicense
    genArgs.generated = autoGeneratedMessage
    genArgs.outdir    = options.outdir.strip()

    generate(apis, genArgs)
예제 #4
0
def main():

    parser = OptionParser()
    parser.add_option('-a',
                      '--api',
                      dest='apis',
                      metavar='API VERSION',
                      action='append',
                      nargs=2,
                      help='generate loader for API and VERSION')
    parser.add_option('-c',
                      '--copyright',
                      dest='copyright',
                      action='store_true',
                      help='include copyright notice')
    parser.add_option('--outdir',
                      dest='outdir',
                      metavar='DIR',
                      help='output directory')
    parser.set_defaults(apis=[])
    (options, args) = parser.parse_args()

    if not len(options.apis):
        parser.error('Specify an api.\n  See Export.py --help')

    if not options.outdir:
        parser.error('Specify output directory.\n  See Export.py --help')

    apis = []
    for apiItem in options.apis:

        # Some fakery for gles - use the gl database

        if apiItem[0] == 'gles':
            api = deepcopy(importAttr('gl'))
            api.name = 'gles'
        else:
            api = importAttr(apiItem[0])

        api.version = float(apiItem[1])
        api.name = '%s' % apiItem[0]
        apis.append(api)

    class Args(object):
        pass

    genArgs = Args()

    genArgs.copyright = ''
    if options.copyright:
        genArgs.copyright = copyrightMessage

    genArgs.license = regalLicense
    genArgs.generated = autoGeneratedMessage
    genArgs.srcdir = options.outdir + '/src/regal'
    genArgs.testdir = options.outdir + '/tests'
    genArgs.incdir = options.outdir + '/include/GL'

    for path in (genArgs.incdir, genArgs.srcdir):
        if not os.path.exists(path):
            os.makedirs(path)
            print 'Directory created: %s' % path

    generate(apis, genArgs)