forked from mirrors/gstreamer-rs
Fix generator
This commit is contained in:
parent
b69c117908
commit
da002aa98c
1 changed files with 10 additions and 13 deletions
21
generator.py
21
generator.py
|
@ -8,20 +8,11 @@ import sys
|
||||||
need_rebuild = False
|
need_rebuild = False
|
||||||
|
|
||||||
def update_workspace():
|
def update_workspace():
|
||||||
with open('Cargo.toml', 'r') as f:
|
|
||||||
old_lines = f.readlines()
|
|
||||||
lines = old_lines[:]
|
|
||||||
with open('Cargo.toml', 'w') as f:
|
|
||||||
lines.insert(len(lines) - 2, '"gir",')
|
|
||||||
f.write(''.join(lines))
|
|
||||||
success = True
|
|
||||||
try:
|
try:
|
||||||
call(['bash', '-c', 'cd gir && cargo build --release'])
|
call(['bash', '-c', 'cd gir && cargo build --release'])
|
||||||
except:
|
except:
|
||||||
success = False
|
return False
|
||||||
with open('Cargo.toml', 'w') as f:
|
return True
|
||||||
f.write(''.join(old_lines))
|
|
||||||
return success
|
|
||||||
|
|
||||||
|
|
||||||
if not isfile('./gir/src'):
|
if not isfile('./gir/src'):
|
||||||
|
@ -54,7 +45,13 @@ print('=> Regenerating crates...')
|
||||||
for entry in [f for f in listdir('.') if isfile(join('.', f))]:
|
for entry in [f for f in listdir('.') if isfile(join('.', f))]:
|
||||||
if entry.startswith('Gir_Gst') and entry.endswith('.toml'):
|
if entry.startswith('Gir_Gst') and entry.endswith('.toml'):
|
||||||
print('==> Regenerating "{}"...'.format(entry))
|
print('==> Regenerating "{}"...'.format(entry))
|
||||||
call(['./target/release/gir', '-c', entry])
|
try:
|
||||||
|
call(['./gir/target/release/gir', '-c', entry])
|
||||||
|
except Exception as err:
|
||||||
|
print('The following error occurred: {}'.format(err))
|
||||||
|
line = input('Do you want to continue? [y/N] ').strip().lower()
|
||||||
|
if line != 'y':
|
||||||
|
sys.exit(1)
|
||||||
print('<== Done!')
|
print('<== Done!')
|
||||||
call(['cargo', 'fmt'])
|
call(['cargo', 'fmt'])
|
||||||
print('<= Done!')
|
print('<= Done!')
|
||||||
|
|
Loading…
Reference in a new issue