mirror of
https://gitlab.com/openlp/documentation.git
synced 2024-12-22 12:32:48 +00:00
Make directories before creating file
bzr-revno: 134
This commit is contained in:
parent
3fef5ad281
commit
429231d423
@ -36,6 +36,9 @@ def find_modules(importer, module, package):
|
|||||||
underline = str(len(title) * '=')
|
underline = str(len(title) * '=')
|
||||||
values = {'underline': underline, 'title': title, 'module': module}
|
values = {'underline': underline, 'title': title, 'module': module}
|
||||||
path = os.path.join(find_modules.root_path, module.replace('.', os.path.sep) + '.rst')
|
path = os.path.join(find_modules.root_path, module.replace('.', os.path.sep) + '.rst')
|
||||||
|
base_path = os.path.basename(path)
|
||||||
|
if not os.path.exists(base_path):
|
||||||
|
os.makedirs(base_path, '0755')
|
||||||
if package:
|
if package:
|
||||||
with open(os.path.join(path), 'w+') as file:
|
with open(os.path.join(path), 'w+') as file:
|
||||||
file.write(PACKAGE_RST.substitute(values))
|
file.write(PACKAGE_RST.substitute(values))
|
||||||
@ -47,13 +50,14 @@ def find_modules(importer, module, package):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
print('Failed to import {0}{1}'.format(module, ' '*25))
|
print('Failed to import {0}{1}'.format(module, ' '*25))
|
||||||
raise
|
raise
|
||||||
except:
|
except Exception:
|
||||||
print('Failed in module {0}'.format(module))
|
print('Failed in module {0}'.format(module))
|
||||||
raise
|
raise
|
||||||
for name in finder.modules.keys():
|
for name in finder.modules.keys():
|
||||||
if name.startswith('sqlalchemy'):
|
if name.startswith('sqlalchemy'):
|
||||||
exclude = " :exclude-members: mapper, or_, and_\n"
|
exclude = " :exclude-members: mapper, or_, and_\n"
|
||||||
values['exclude'] = exclude
|
values['exclude'] = exclude
|
||||||
|
|
||||||
with open(os.path.join(path), 'w+') as file:
|
with open(os.path.join(path), 'w+') as file:
|
||||||
file.write(MODULE_RST.substitute(values))
|
file.write(MODULE_RST.substitute(values))
|
||||||
find_modules.queue.put(module)
|
find_modules.queue.put(module)
|
||||||
@ -121,4 +125,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user