forked from dropbox/dropbox-sdk-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.py
executable file
·30 lines (25 loc) · 903 Bytes
/
generate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import glob
import os
import shutil
import subprocess
def main():
"""The entry point for the program."""
repo_path = 'dropbox-sdk-dotnet'
print('Generating code')
try:
for path in glob.glob(os.path.join(repo_path, 'Dropbox.Api/*.csproj')):
os.remove(path)
shutil.rmtree(os.path.join(repo_path, 'Dropbox.Api', 'Generated'))
except OSError:
pass
try:
subprocess.check_output(
(['python', '-m', 'stone.cli', '--filter-by-route-attr', 'alpah_group=null', '-a:all', 'generator/csharp.stoneg.py'] +
[os.path.join(repo_path, 'Dropbox.Api')] + glob.glob('spec/*.stone')),
env={'PYTHONPATH': 'stone'})
except subprocess.CalledProcessError as e:
print(e.output)
if __name__ == '__main__':
main()