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
f47db47c
Commit
f47db47c
authored
May 06, 2015
by
Joshua Haberman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #281 from tamird/cleanup-setup-py
Cleanup setup.py
parents
1f34eb6e
21a7cf96
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
100 additions
and
92 deletions
+100
-92
.gitignore
.gitignore
+1
-0
add_person.py
examples/add_person.py
+1
-1
list_people.py
examples/list_people.py
+1
-1
MANIFEST.in
python/MANIFEST.in
+14
-0
_parameterized.py
python/google/protobuf/internal/_parameterized.py
+1
-1
descriptor_database_test.py
python/google/protobuf/internal/descriptor_database_test.py
+1
-1
descriptor_pool_test.py
python/google/protobuf/internal/descriptor_pool_test.py
+1
-1
descriptor_test.py
python/google/protobuf/internal/descriptor_test.py
+1
-1
generator_test.py
python/google/protobuf/internal/generator_test.py
+1
-1
message_factory_test.py
python/google/protobuf/internal/message_factory_test.py
+1
-1
message_test.py
python/google/protobuf/internal/message_test.py
+1
-1
proto_builder_test.py
python/google/protobuf/internal/proto_builder_test.py
+1
-1
reflection_test.py
python/google/protobuf/internal/reflection_test.py
+1
-1
service_reflection_test.py
python/google/protobuf/internal/service_reflection_test.py
+1
-1
symbol_database_test.py
python/google/protobuf/internal/symbol_database_test.py
+1
-1
text_encoding_test.py
python/google/protobuf/internal/text_encoding_test.py
+1
-1
text_format_test.py
python/google/protobuf/internal/text_format_test.py
+1
-1
unknown_fields_test.py
python/google/protobuf/internal/unknown_fields_test.py
+1
-1
wire_format_test.py
python/google/protobuf/internal/wire_format_test.py
+1
-1
setup.py
python/setup.py
+67
-74
arena_nc_test.py
src/google/protobuf/arena_nc_test.py
+1
-1
No files found.
.gitignore
View file @
f47db47c
...
@@ -51,6 +51,7 @@ cpp_test*.pb.*
...
@@ -51,6 +51,7 @@ cpp_test*.pb.*
*.pyc
*.pyc
*.egg-info
*.egg-info
*_pb2.py
*_pb2.py
python/*.egg
python/.eggs/
python/.eggs/
python/build/
python/build/
python/google/protobuf/compiler/
python/google/protobuf/compiler/
...
...
examples/add_person.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
# See README.txt for information and build instructions.
# See README.txt for information and build instructions.
...
...
examples/list_people.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
# See README.txt for information and build instructions.
# See README.txt for information and build instructions.
...
...
python/MANIFEST.in
0 → 100644
View file @
f47db47c
prune google/protobuf/internal/import_test_package
exclude google/protobuf/internal/*_pb2.py
exclude google/protobuf/internal/*_test.py
exclude google/protobuf/internal/*.proto
exclude google/protobuf/internal/test_util.py
recursive-exclude google *_test.py
recursive-exclude google *_test.proto
recursive-exclude google unittest*_pb2.py
global-exclude *.dll
global-exclude *.pyc
global-exclude *.pyo
global-exclude *.so
python/google/protobuf/internal/_parameterized.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/descriptor_database_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/descriptor_pool_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/descriptor_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/generator_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/message_factory_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/message_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/proto_builder_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/reflection_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
...
...
python/google/protobuf/internal/service_reflection_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/symbol_database_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/text_encoding_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/text_format_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/google/protobuf/internal/unknown_fields_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
...
...
python/google/protobuf/internal/wire_format_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
python/setup.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# See README for usage instructions.
# See README for usage instructions.
import
sys
import
sys
...
@@ -8,19 +8,22 @@ import subprocess
...
@@ -8,19 +8,22 @@ import subprocess
# We must use setuptools, not distutils, because we need to use the
# We must use setuptools, not distutils, because we need to use the
# namespace_packages option for the "google" package.
# namespace_packages option for the "google" package.
try
:
try
:
from
setuptools
import
setup
,
Extension
from
setuptools
import
setup
,
Extension
,
find_packages
except
ImportError
:
except
ImportError
:
try
:
try
:
from
ez_setup
import
use_setuptools
from
ez_setup
import
use_setuptools
use_setuptools
()
use_setuptools
()
from
setuptools
import
setup
,
Extension
from
setuptools
import
setup
,
Extension
,
find_packages
except
ImportError
:
except
ImportError
:
sys
.
stderr
.
write
(
sys
.
stderr
.
write
(
"Could not import setuptools; make sure you have setuptools or "
"Could not import setuptools; make sure you have setuptools or "
"ez_setup installed.
\n
"
)
"ez_setup installed.
\n
"
)
raise
raise
from
distutils.command.clean
import
clean
as
_clean
from
distutils.command.clean
import
clean
as
_clean
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
==
3
:
# Python 3
# Python 3
from
distutils.command.build_py
import
build_py_2to3
as
_build_py
from
distutils.command.build_py
import
build_py_2to3
as
_build_py
else
:
else
:
...
@@ -28,8 +31,6 @@ else:
...
@@ -28,8 +31,6 @@ else:
from
distutils.command.build_py
import
build_py
as
_build_py
from
distutils.command.build_py
import
build_py
as
_build_py
from
distutils.spawn
import
find_executable
from
distutils.spawn
import
find_executable
maintainer_email
=
"protobuf@googlegroups.com"
# Find the Protocol Compiler.
# Find the Protocol Compiler.
if
'PROTOC'
in
os
.
environ
and
os
.
path
.
exists
(
os
.
environ
[
'PROTOC'
]):
if
'PROTOC'
in
os
.
environ
and
os
.
path
.
exists
(
os
.
environ
[
'PROTOC'
]):
protoc
=
os
.
environ
[
'PROTOC'
]
protoc
=
os
.
environ
[
'PROTOC'
]
...
@@ -44,13 +45,13 @@ elif os.path.exists("../vsprojects/Release/protoc.exe"):
...
@@ -44,13 +45,13 @@ elif os.path.exists("../vsprojects/Release/protoc.exe"):
else
:
else
:
protoc
=
find_executable
(
"protoc"
)
protoc
=
find_executable
(
"protoc"
)
def
GetVersion
():
def
GetVersion
():
"""Gets the version from google/protobuf/__init__.py
"""Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf
Do not import google.protobuf.__init__ directly, because an installed
library may be loaded instead.
protobuf library may be loaded instead."""
"""
with
open
(
os
.
path
.
join
(
'google'
,
'protobuf'
,
'__init__.py'
))
as
version_file
:
with
open
(
os
.
path
.
join
(
'google'
,
'protobuf'
,
'__init__.py'
))
as
version_file
:
exec
(
version_file
.
read
())
exec
(
version_file
.
read
())
return
__version__
return
__version__
...
@@ -66,22 +67,24 @@ def generate_proto(source):
...
@@ -66,22 +67,24 @@ def generate_proto(source):
if
(
not
os
.
path
.
exists
(
output
)
or
if
(
not
os
.
path
.
exists
(
output
)
or
(
os
.
path
.
exists
(
source
)
and
(
os
.
path
.
exists
(
source
)
and
os
.
path
.
getmtime
(
source
)
>
os
.
path
.
getmtime
(
output
))):
os
.
path
.
getmtime
(
source
)
>
os
.
path
.
getmtime
(
output
))):
print
(
"Generating
%
s..."
%
output
)
print
(
"Generating
%
s..."
%
output
)
if
not
os
.
path
.
exists
(
source
):
if
not
os
.
path
.
exists
(
source
):
sys
.
stderr
.
write
(
"Can't find required file:
%
s
\n
"
%
source
)
sys
.
stderr
.
write
(
"Can't find required file:
%
s
\n
"
%
source
)
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
if
protoc
==
None
:
if
protoc
is
None
:
sys
.
stderr
.
write
(
sys
.
stderr
.
write
(
"protoc is not installed nor found in ../src. Please compile it "
"protoc is not installed nor found in ../src. "
"or install the binary package.
\n
"
)
"Please compile it or install the binary package.
\n
"
)
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
protoc_command
=
[
protoc
,
"-I../src"
,
"-I."
,
"--python_out=."
,
source
]
protoc_command
=
[
protoc
,
"-I../src"
,
"-I."
,
"--python_out=."
,
source
]
if
subprocess
.
call
(
protoc_command
)
!=
0
:
if
subprocess
.
call
(
protoc_command
)
!=
0
:
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
def
GenerateUnittestProtos
():
def
GenerateUnittestProtos
():
generate_proto
(
"../src/google/protobuf/unittest.proto"
)
generate_proto
(
"../src/google/protobuf/unittest.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_custom_options.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_custom_options.proto"
)
...
@@ -92,17 +95,18 @@ def GenerateUnittestProtos():
...
@@ -92,17 +95,18 @@ def GenerateUnittestProtos():
generate_proto
(
"../src/google/protobuf/unittest_proto3_arena.proto"
)
generate_proto
(
"../src/google/protobuf/unittest_proto3_arena.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test1.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test1.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test2.proto"
)
generate_proto
(
"google/protobuf/internal/descriptor_pool_test2.proto"
)
generate_proto
(
"google/protobuf/internal/test_bad_identifiers.proto"
)
generate_proto
(
"google/protobuf/internal/missing_enum_values.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions_dynamic.proto"
)
generate_proto
(
"google/protobuf/internal/more_messages.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test1.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test1.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test2.proto"
)
generate_proto
(
"google/protobuf/internal/factory_test2.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/inner.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/inner.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/outer.proto"
)
generate_proto
(
"google/protobuf/internal/import_test_package/outer.proto"
)
generate_proto
(
"google/protobuf/internal/missing_enum_values.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions.proto"
)
generate_proto
(
"google/protobuf/internal/more_extensions_dynamic.proto"
)
generate_proto
(
"google/protobuf/internal/more_messages.proto"
)
generate_proto
(
"google/protobuf/internal/test_bad_identifiers.proto"
)
generate_proto
(
"google/protobuf/pyext/python.proto"
)
generate_proto
(
"google/protobuf/pyext/python.proto"
)
class
clean
(
_clean
):
class
clean
(
_clean
):
def
run
(
self
):
def
run
(
self
):
# Delete generated files in the code tree.
# Delete generated files in the code tree.
...
@@ -116,6 +120,7 @@ class clean(_clean):
...
@@ -116,6 +120,7 @@ class clean(_clean):
# _clean is an old-style class, so super() doesn't work.
# _clean is an old-style class, so super() doesn't work.
_clean
.
run
(
self
)
_clean
.
run
(
self
)
class
build_py
(
_build_py
):
class
build_py
(
_build_py
):
def
run
(
self
):
def
run
(
self
):
# Generate necessary .proto file if it doesn't exist.
# Generate necessary .proto file if it doesn't exist.
...
@@ -132,11 +137,11 @@ class build_py(_build_py):
...
@@ -132,11 +137,11 @@ class build_py(_build_py):
# _build_py is an old-style class, so super() doesn't work.
# _build_py is an old-style class, so super() doesn't work.
_build_py
.
run
(
self
)
_build_py
.
run
(
self
)
# TODO(mrovner): Subclass to run 2to3 on some files only.
# TODO(mrovner): Subclass to run 2to3 on some files only.
# Tracing what https://wiki.python.org/moin/PortingPythonToPy3k's
"Approach 2"
# Tracing what https://wiki.python.org/moin/PortingPythonToPy3k's
#
section on how to get 2to3 to run on source files during install under
#
"Approach 2" section on how to get 2to3 to run on source files during
#
Python 3. This class seems like a good place to put logic that calls
#
install under Python 3. This class seems like a good place to put logic
#
python3's distutils.util.run_2to3 on the subset of the files we have in our
#
that calls python3's distutils.util.run_2to3 on the subset of the files we
# release that are subject to conversion.
#
have in our
release that are subject to conversion.
# See code reference in previous code review.
# See code reference in previous code review.
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -145,61 +150,49 @@ if __name__ == '__main__':
...
@@ -145,61 +150,49 @@ if __name__ == '__main__':
if
cpp_impl
in
sys
.
argv
:
if
cpp_impl
in
sys
.
argv
:
sys
.
argv
.
remove
(
cpp_impl
)
sys
.
argv
.
remove
(
cpp_impl
)
# C++ implementation extension
# C++ implementation extension
ext_module_list
.
append
(
Extension
(
ext_module_list
.
append
(
Extension
(
"google.protobuf.pyext._message"
,
"google.protobuf.pyext._message"
,
[
"google/protobuf/pyext/descriptor.cc"
,
[
"google/protobuf/pyext/descriptor.cc"
,
"google/protobuf/pyext/descriptor_containers.cc"
,
"google/protobuf/pyext/descriptor_containers.cc"
,
"google/protobuf/pyext/descriptor_pool.cc"
,
"google/protobuf/pyext/descriptor_pool.cc"
,
"google/protobuf/pyext/message.cc"
,
"google/protobuf/pyext/extension_dict.cc"
,
"google/protobuf/pyext/extension_dict.cc"
,
"google/protobuf/pyext/message.cc"
,
"google/protobuf/pyext/repeated_composite_container.cc"
,
"google/protobuf/pyext/repeated_scalar_container.cc"
,
"google/protobuf/pyext/repeated_scalar_container.cc"
,
"google/protobuf/pyext/repeated_composite_container.cc"
],
],
define_macros
=
[(
'GOOGLE_PROTOBUF_HAS_ONEOF'
,
'1'
)],
define_macros
=
[(
'GOOGLE_PROTOBUF_HAS_ONEOF'
,
'1'
)],
include_dirs
=
[
"."
,
"../src"
],
include_dirs
=
[
"."
,
"../src"
],
libraries
=
[
"protobuf"
],
libraries
=
[
'protobuf'
],
library_dirs
=
[
'../src/.libs'
],
library_dirs
=
[
'../src/.libs'
],
))
)
)
os
.
environ
[
'PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'
]
=
'cpp'
os
.
environ
[
'PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'
]
=
'cpp'
setup
(
name
=
'protobuf'
,
setup
(
version
=
GetVersion
(),
name
=
'protobuf'
,
packages
=
[
'google'
],
version
=
GetVersion
(),
namespace_packages
=
[
'google'
],
description
=
'Protocol Buffers'
,
test_suite
=
'google.protobuf.internal'
,
long_description
=
"Protocol Buffers are Google's data interchange format"
,
# Must list modules explicitly so that we don't install tests.
url
=
'https://developers.google.com/protocol-buffers/'
,
py_modules
=
[
maintainer
=
'protobuf@googlegroups.com'
,
'google.protobuf.internal.api_implementation'
,
maintainer_email
=
'protobuf@googlegroups.com'
,
'google.protobuf.internal.containers'
,
license
=
'New BSD License'
,
'google.protobuf.internal.decoder'
,
classifiers
=
[
'google.protobuf.internal.encoder'
,
'Programming Language :: Python :: 2.7'
,
'google.protobuf.internal.enum_type_wrapper'
,
],
'google.protobuf.internal.message_listener'
,
namespace_packages
=
[
'google'
],
'google.protobuf.internal.python_message'
,
packages
=
find_packages
(
'google.protobuf.internal.type_checkers'
,
exclude
=
[
'google.protobuf.internal.wire_format'
,
'import_test_package'
,
'google.protobuf.descriptor'
,
],
'google.protobuf.descriptor_pb2'
,
),
'google.protobuf.compiler.plugin_pb2'
,
test_suite
=
'google.protobuf.internal'
,
'google.protobuf.message'
,
cmdclass
=
{
'google.protobuf.descriptor_database'
,
'clean'
:
clean
,
'google.protobuf.descriptor_pool'
,
'build_py'
:
build_py
,
'google.protobuf.message_factory'
,
},
'google.protobuf.proto_builder'
,
install_requires
=
[
'setuptools'
],
'google.protobuf.pyext.cpp_message'
,
ext_modules
=
ext_module_list
,
'google.protobuf.reflection'
,
'google.protobuf.service'
,
'google.protobuf.service_reflection'
,
'google.protobuf.symbol_database'
,
'google.protobuf.text_encoding'
,
'google.protobuf.text_format'
],
cmdclass
=
{
'clean'
:
clean
,
'build_py'
:
build_py
},
install_requires
=
[
'setuptools'
],
ext_modules
=
ext_module_list
,
url
=
'https://developers.google.com/protocol-buffers/'
,
maintainer
=
maintainer_email
,
maintainer_email
=
'protobuf@googlegroups.com'
,
license
=
'New BSD License'
,
description
=
'Protocol Buffers'
,
long_description
=
"Protocol Buffers are Google's data interchange format."
,
)
)
src/google/protobuf/arena_nc_test.py
View file @
f47db47c
#! /usr/bin/python
#! /usr/bin/
env
python
#
#
# Protocol Buffers - Google's data interchange format
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# Copyright 2008 Google Inc. All rights reserved.
...
...
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