@task
@cmdopts([('path=', 'p', 'Thrift path'), ('gen=', 'g', 'Extra --gen option')])
def thrift(options):
 print 'add import for TApplicationException manually as long it is not fixed'
 outdir = ((path('module') / 'remote') / 'thriftbackend')
 (outdir / 'gen-py').rmtree()
 cmd = [options.thrift.path, '-strict', '-o', outdir, '--gen', 'py:slots,dynamic', (outdir / 'pyload.thrift')]
 if options.gen:
  cmd.insert((len(cmd) - 1), '--gen')
  cmd.insert((len(cmd) - 1), options.gen)
 print 'running', cmd
 p = Popen(cmd)
 p.communicate()
 (outdir / 'thriftgen').rmtree()
 (outdir / 'gen-py').move((outdir / 'thriftgen'))
 from module.remote.socketbackend.create_ttypes import main
 main()

@ task @ cmdopts ( [ ( 'path=' , 'p' , 'Thrift path' ) , ( 'gen=' , 'g' , 'Extra --gen option' ) ] ) def thrift ( options ) : print 'add import for TApplicationException manually as long it is not fixed' outdir = ( ( path ( 'module' ) / 'remote' ) / 'thriftbackend' ) ( outdir / 'gen-py' ) . rmtree ( ) cmd = [ options . thrift . path , '-strict' , '-o' , outdir , '--gen' , 'py:slots,dynamic' , ( outdir / 'pyload.thrift' ) ] if options . gen : cmd . insert ( ( len ( cmd ) - 1 ) , '--gen' ) cmd . insert ( ( len ( cmd ) - 1 ) , options . gen ) print 'running' , cmd p = Popen ( cmd ) p . communicate ( ) ( outdir / 'thriftgen' ) . rmtree ( ) ( outdir / 'gen-py' ) . move ( ( outdir / 'thriftgen' ) ) from module . remote . socketbackend . create_ttypes import main main ( )
generate thrift stubs .