def execute(self, src_proto_path, import_proto_path, common_protos_yaml,
organization_name):
self._organization_name = organization_name
with io.open(common_protos_yaml) as file_:
common_protos_data = yaml.load(file_, Loader=yaml.Loader)
# Treat google.protobuf, google.iam as a common proto package, even
# though they are not included in the common-protos we generate.
#
# TODO (geigerj): remove 'google.iam' when it is included in the common
# protos package.
common_protos = ['google.protobuf', 'google.iam']
for package in common_protos_data['packages']:
common_protos.append('google.' + package['name'].replace('/', '.'))
tmpdir = os.path.join(
tempfile.gettempdir(), 'artman-python', str(int(time.time())))
new_proto_dir = os.path.join(tmpdir, 'proto')
new_src_path = set()
new_import_path = [new_proto_dir]
self._copy_and_transform_directories(
src_proto_path, new_proto_dir, common_protos, paths=new_src_path)
self._copy_and_transform_directories(
import_proto_path, new_proto_dir, common_protos)
# Update src_proto_path, import_proto_path
return list(new_src_path), new_import_path
评论列表
文章目录