def __init__(self, context): CodeGen.__init__(self, context) output_dir = ( context.options.thrift_gen_create_outdir or context.config.get('thrift-gen', 'workdir') ) self.combined_dir = os.path.join(output_dir, 'combined') self.session_dir = os.path.join(output_dir, 'sessions') self.strict = context.config.getbool('thrift-gen', 'strict') self.verbose = context.config.getbool('thrift-gen', 'verbose') def create_geninfo(key): gen_info = context.config.getdict('thrift-gen', key) gen = gen_info['gen'] deps = {} for category, depspecs in gen_info['deps'].items(): dependencies = OrderedSet() deps[category] = dependencies for depspec in depspecs: dependencies.update(context.resolve(depspec)) return self.GenInfo(gen, deps) self.gen_java = create_geninfo('java') self.gen_python = create_geninfo('python') self.gen_langs = set(context.options.thrift_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.thrift_binary = select_thrift_binary(context.config, version=context.options.thrift_version)
def thrift_binary(self): if self._thrift_binary is None: self._thrift_binary = select_thrift_binary( self.context.config, version=self.get_options().version ) return self._thrift_binary
def __init__(self, context, workdir): CodeGen.__init__(self, context, workdir) self.combined_dir = os.path.join(self.workdir, 'combined') self.combined_relpath = os.path.relpath(self.combined_dir, get_buildroot()) self.session_dir = os.path.join(self.workdir, 'sessions') self.strict = context.config.getbool('thrift-gen', 'strict') self.verbose = context.config.getbool('thrift-gen', 'verbose') def create_geninfo(key): gen_info = context.config.getdict('thrift-gen', key) gen = gen_info['gen'] deps = {} for category, depspecs in gen_info['deps'].items(): dependencies = OrderedSet() deps[category] = dependencies for depspec in depspecs: dependencies.update(context.resolve(depspec)) return self.GenInfo(gen, deps) self.gen_java = create_geninfo('java') self.gen_python = create_geninfo('python') self.gen_langs = set(context.options.thrift_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.thrift_binary = select_thrift_binary( context.config, version=context.options.thrift_version) self.defaults = JavaThriftLibrary.Defaults(context.config)
def _run_thrift(self, source): args = [ select_thrift_binary(self.config), '--gen', 'py:new_style', '-o', self.codegen_root, '-I', self._workdir, os.path.abspath(source) ] po = subprocess.Popen(args, cwd=self.chroot.path()) rv = po.wait() if rv != 0: comm = po.communicate() print('thrift generation failed!', file=sys.stderr) print('STDOUT', file=sys.stderr) print(comm[0], file=sys.stderr) print('STDERR', file=sys.stderr) print(comm[1], file=sys.stderr) return rv == 0
def __init__(self, context, workdir): super(ApacheThriftGen, self).__init__(context, workdir) self.combined_dir = os.path.join(self.workdir, 'combined') self.combined_relpath = os.path.relpath(self.combined_dir, get_buildroot()) self.session_dir = os.path.join(self.workdir, 'sessions') self.strict = context.config.getbool('thrift-gen', 'strict') self.verbose = context.config.getbool('thrift-gen', 'verbose') self.gen_langs = set(context.options.thrift_gen_langs) for lang in ('java', 'python'): if self.context.products.isrequired(lang): self.gen_langs.add(lang) self.thrift_binary = select_thrift_binary(context.config, version=context.options.thrift_version) self.defaults = JavaThriftLibrary.Defaults(context.config)
def _run_thrift(self, source): args = [ select_thrift_binary(self.options.for_scope('gen.thrift')), '--gen', 'py:new_style', '-o', self.codegen_root, '-I', self._workdir, os.path.abspath(source)] po = subprocess.Popen(args, cwd=self.chroot.path()) rv = po.wait() if rv != 0: comm = po.communicate() print('thrift generation failed!', file=sys.stderr) print('STDOUT', file=sys.stderr) print(comm[0], file=sys.stderr) print('STDERR', file=sys.stderr) print(comm[1], file=sys.stderr) return rv == 0
def _run_thrift(self, source): args = [ select_thrift_binary(self.config), "--gen", "py:new_style", "-o", self.codegen_root, "-I", self._workdir, os.path.abspath(source), ] po = subprocess.Popen(args, cwd=self.chroot.path()) rv = po.wait() if rv != 0: comm = po.communicate() print("thrift generation failed!", file=sys.stderr) print("STDOUT", file=sys.stderr) print(comm[0], file=sys.stderr) print("STDERR", file=sys.stderr) print(comm[1], file=sys.stderr) return rv == 0
def thrift_binary(self): return select_thrift_binary(self.get_options())
def thrift_binary(self): if self._thrift_binary is None: self._thrift_binary = select_thrift_binary( self.context.config, version=self.get_options().version) return self._thrift_binary
def thrift_binary(self): if self._thrift_binary is None: self._thrift_binary = select_thrift_binary(self.context.options) return self._thrift_binary
def thrift_binary(self): if self._thrift_binary is None: self._thrift_binary = select_thrift_binary(self.get_options()) return self._thrift_binary