Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
c6e0d0e7
Commit
c6e0d0e7
authored
Feb 10, 2017
by
Jie Luo
Committed by
GitHub
Feb 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2647 from anandolee/master
Fix python compatibility test
parents
e844510f
42e1e2ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
test.sh
python/compatibility_tests/v2.5.0/test.sh
+4
-10
python_generator.cc
src/google/protobuf/compiler/python/python_generator.cc
+10
-1
No files found.
python/compatibility_tests/v2.5.0/test.sh
View file @
c6e0d0e7
...
...
@@ -92,16 +92,10 @@ python setup.py test
# Test A.3:
# proto set 1: use old version
# proto set 2 which may import protos in set 1: use new version
# Compatiblility test fail if the old verison is less than 3.0.0-alpha-1.
# Because module name aliases was added in v3.0.0-alpha-1 instead of
# fully-qualified module names to refer to dependencies: dot was replaced
# with _dot_.
if
[
"
$(
printf
"
$OLD_VERSION
\n
3.0.0"
|
sort
-V
|
head
-n
1
)
"
=
"3.0.0"
]
;
then
cp
old_protoc protoc_1
cp
../../../src/protoc protoc_2
python setup.py build
python setup.py
test
fi
cp
old_protoc protoc_1
cp
../../../src/protoc protoc_2
python setup.py build
python setup.py
test
rm
google
-r
-f
rm
build
-r
-f
...
...
src/google/protobuf/compiler/python/python_generator.cc
View file @
c6e0d0e7
...
...
@@ -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
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment