Eolian: Use all_eo_files_parse and add a command line arg for docs gen
This commit is contained in:
parent
7810bcb216
commit
39e7a7a2fd
|
@ -9,8 +9,12 @@ from collections import Counter
|
|||
|
||||
from argparse import ArgumentParser
|
||||
parser = ArgumentParser(description="Python generator for eolian")
|
||||
parser.add_argument('-v', '--verbose', action="count")
|
||||
parser.add_argument('-o', '--output', default="/tmp", help="max is -vvv")
|
||||
parser.add_argument(
|
||||
'-v', '--verbose', action="count", help="max is -vvv")
|
||||
parser.add_argument(
|
||||
'--enable-docstrings', action="store_true")
|
||||
parser.add_argument(
|
||||
'-o', '--output', default="/tmp")
|
||||
parser.add_argument('paths', nargs="+")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -29,8 +33,6 @@ log.setLevel(level)
|
|||
from efl import eolian
|
||||
eolian.init()
|
||||
|
||||
DOCSTRINGS_ENABLED = True
|
||||
|
||||
import re
|
||||
|
||||
enum_re = re.compile(r"typedef\s+enum\s*{([^}]*)}([^;]+);")
|
||||
|
@ -137,7 +139,7 @@ class Generator(object):
|
|||
self.result.append("")
|
||||
|
||||
def docstring_write(self, docstrings):
|
||||
if not DOCSTRINGS_ENABLED or not docstrings:
|
||||
if not args.docstrings or not docstrings:
|
||||
return
|
||||
elif len(docstrings) == 1:
|
||||
self.write('"""' + docstrings[0] + '"""')
|
||||
|
@ -892,11 +894,12 @@ generated_function_counter = Counter()
|
|||
for path in args.paths:
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
eolian.directory_scan(dirpath)
|
||||
for filename in filenames:
|
||||
if filename.endswith(".eo"):
|
||||
f = os.path.join(dirpath, filename)
|
||||
if not eolian.eo_file_parse(f):
|
||||
log.warn("Errors in parsing %s" % (f))
|
||||
eolian.all_eo_files_parse()
|
||||
# for filename in filenames:
|
||||
# if filename.endswith(".eo"):
|
||||
# f = os.path.join(dirpath, filename)
|
||||
# if not eolian.eo_file_parse(f):
|
||||
# log.warn("Errors in parsing %s" % (f))
|
||||
|
||||
|
||||
with open(py_path, "a") as py_f:
|
||||
|
|
Loading…
Reference in New Issue