8 from setuptools
import setup, Extension, find_packages
10 if sys.version_info[0] == 3:
12 from distutils.command.build_py
import build_py_2to3
as _build_py
15 from distutils.command.build_py
import build_py
as _build_py
16 from distutils.spawn
import find_executable
19 """Invokes the Protocol Compiler to generate a _pb2.py from the given
21 output = source.replace(
".proto",
"_pb2.py").replace(
"protos/src/proto/",
"").replace(
"protos/python/",
"")
23 if not os.path.exists(source):
24 sys.stderr.write(
"Can't find required file: %s\n" % source)
27 protoc_command = [ code_gen,
"-Iprotos/src/proto",
"-Iprotos/python",
"--python_out=.", source ]
28 if subprocess.call(protoc_command) != 0:
34 protoc_1 =
"./protoc_1"
35 protoc_2 =
"./protoc_2"
36 generate_proto(
"protos/src/proto/google/protobuf/unittest.proto", protoc_2)
37 generate_proto(
"protos/src/proto/google/protobuf/unittest_custom_options.proto", protoc_1)
38 generate_proto(
"protos/src/proto/google/protobuf/unittest_import.proto", protoc_1)
39 generate_proto(
"protos/src/proto/google/protobuf/unittest_import_public.proto", protoc_1)
40 generate_proto(
"protos/src/proto/google/protobuf/unittest_mset.proto", protoc_1)
41 generate_proto(
"protos/src/proto/google/protobuf/unittest_no_generic_services.proto", protoc_1)
42 generate_proto(
"protos/python/google/protobuf/internal/factory_test1.proto", protoc_1)
43 generate_proto(
"protos/python/google/protobuf/internal/factory_test2.proto", protoc_1)
44 generate_proto(
"protos/python/google/protobuf/internal/more_extensions.proto", protoc_1)
45 generate_proto(
"protos/python/google/protobuf/internal/more_extensions_dynamic.proto", protoc_1)
46 generate_proto(
"protos/python/google/protobuf/internal/more_messages.proto", protoc_1)
47 generate_proto(
"protos/python/google/protobuf/internal/test_bad_identifiers.proto", protoc_1)
52 if __name__ ==
'__main__':
54 install_requires = [
'six>=1.9',
'setuptools']
55 if sys.version_info <= (2,7):
56 install_requires.append(
'ordereddict')
57 install_requires.append(
'unittest2')
61 description=
'Protocol Buffers',
62 download_url=
'https://github.com/protocolbuffers/protobuf/releases',
63 long_description=
"Protocol Buffers are Google's data interchange format",
64 url=
'https://developers.google.com/protocol-buffers/',
65 maintainer=
'protobuf@googlegroups.com',
66 maintainer_email=
'protobuf@googlegroups.com',
67 license=
'3-Clause BSD License',
69 "Programming Language :: Python",
70 "Programming Language :: Python :: 2",
71 "Programming Language :: Python :: 2.6",
72 "Programming Language :: Python :: 2.7",
73 "Programming Language :: Python :: 3",
74 "Programming Language :: Python :: 3.3",
75 "Programming Language :: Python :: 3.4",
77 packages=find_packages(
79 'import_test_package',
82 test_suite=
'tests.google.protobuf.internal',
86 install_requires=install_requires,