|
|
|
@ -1380,8 +1380,17 @@ void Generator::FixOptionsForMessage(const Descriptor& descriptor) const { |
|
|
|
|
void Generator::CopyPublicDependenciesAliases( |
|
|
|
|
const string& copy_from, const FileDescriptor* file) const { |
|
|
|
|
for (int i = 0; i < file->public_dependency_count(); ++i) { |
|
|
|
|
string module_name = ModuleName(file->public_dependency(i)->name()); |
|
|
|
|
string module_alias = ModuleAlias(file->public_dependency(i)->name()); |
|
|
|
|
printer_->Print("$alias$ = $copy_from$.$alias$\n", "alias", module_alias, |
|
|
|
|
// There's no module alias in the dependent file if it was generated by
|
|
|
|
|
// an old protoc (less than 3.0.0-alpha-1). Use module name in this
|
|
|
|
|
// situation.
|
|
|
|
|
printer_->Print("try:\n" |
|
|
|
|
" $alias$ = $copy_from$.$alias$\n" |
|
|
|
|
"except AttributeError:\n" |
|
|
|
|
" $alias$ = $copy_from$.$module$\n", |
|
|
|
|
"alias", module_alias, |
|
|
|
|
"module", module_name, |
|
|
|
|
"copy_from", copy_from); |
|
|
|
|
CopyPublicDependenciesAliases(copy_from, file->public_dependency(i)); |
|
|
|
|
} |
|
|
|
|