License & doc generator

This commit is contained in:
Kload 2013-07-06 09:48:32 +02:00
parent 9e2f264e2f
commit 0305d0039d

View file

@ -46,8 +46,6 @@ def main():
with open('yunohost_'+ category +'.py', 'w') as f: with open('yunohost_'+ category +'.py', 'w') as f:
in_block = False in_block = False
for line in lines: for line in lines:
if re.search(r'^""" yunohost_'+ category, line):
in_block = True
if in_block: if in_block:
if re.search(r'^"""', line): if re.search(r'^"""', line):
in_block = False in_block = False
@ -57,6 +55,9 @@ def main():
else: else:
f.write(line) f.write(line)
if re.search(r'^""" yunohost_'+ category, line):
in_block = True
for action, action_params in category_params['actions'].items(): for action, action_params in category_params['actions'].items():
if 'action_help' not in action_params: if 'action_help' not in action_params:
action_params['action_help'] = '' action_params['action_help'] = ''
@ -94,8 +95,6 @@ def main():
in_block = False in_block = False
first_quotes = True first_quotes = True
for line in lines: for line in lines:
if re.search(r'^def '+ category +'_'+ action, line):
in_block = True
if in_block: if in_block:
if re.search(r'^ """', line): if re.search(r'^ """', line):
if first_quotes: if first_quotes:
@ -107,6 +106,9 @@ def main():
else: else:
f.write(line) f.write(line)
if re.search(r'^def '+ category +'_'+ action, line):
in_block = True
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())