mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +00:00
[parse_xml] replaced OptionParser with ArgumentParser according
to depreciation of first one starting from Python version 3.2.
This commit is contained in:
parent
f5feecd46e
commit
1b17b0b210
@ -127,33 +127,34 @@ def writeExtension(f, name, extension, enums, commands):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from optparse import OptionParser
|
||||
from argparse import ArgumentParser
|
||||
import os
|
||||
|
||||
parser = OptionParser('usage: %prog [options] [XML specs...]')
|
||||
parser.add_option("--core", dest="core", help="location for core outputs", default='')
|
||||
parser.add_option("--api", dest="name", help="API name: egl, wgl, glx, etc", default='')
|
||||
parser.add_option("--extensions", dest="extensions", help="location for extensions outputs", default='')
|
||||
parser = ArgumentParser(description='usage: %prog [options] [XML specs...]')
|
||||
parser.add_argument("--core", dest="core", help="location for core outputs", default='')
|
||||
parser.add_argument("--api", dest="name", help="API name: egl, wgl, glx, etc", default='')
|
||||
parser.add_argument("--extensions", dest="extensions", help="location for extensions outputs", default='')
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
(options, args) = parser.parse_known_args()
|
||||
options = vars(options)
|
||||
|
||||
for i in args:
|
||||
|
||||
dom = parse(i)
|
||||
api = findApi(dom, options.name)
|
||||
api = findApi(dom, options['name'])
|
||||
|
||||
print('Found {} enums, {} commands, {} features and {} extensions.'.format(
|
||||
len(api[0]), len(api[1]), len(api[2]), len(api[3])))
|
||||
|
||||
if len(options.core):
|
||||
if len(options['core']):
|
||||
for i in api[2].keys():
|
||||
f = open('%s/%s'%(options.core, i), 'wb')
|
||||
f = open('%s/%s'%(options['core'], i), 'wb')
|
||||
writeExtension(f, i, api[2][i], api[0], api[1])
|
||||
f.close()
|
||||
|
||||
if len(options.extensions):
|
||||
if len(options['extensions']):
|
||||
for i in api[3].keys():
|
||||
f = open('%s/%s'%(options.extensions, i), 'wb')
|
||||
f = open('%s/%s'%(options['extensions'], i), 'wb')
|
||||
writeExtension(f, i, api[3][i], api[0], api[1])
|
||||
f.close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user