|
28 | 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
|
31 | | -"""Setuptools/distutils extension for generating Python protobuf code. |
32 | | -
|
33 | | -This extension uses a prebuilt 'protoc' binary to generate Python types for |
34 | | -protobuf sources. By default, it will use a system-installed protoc binary, but |
35 | | -a custom protoc can be specified by flag. |
36 | | -
|
37 | | -This command should usually be run before the 'build' command, so that the |
38 | | -generated sources are treated the same way as the rest of the Python |
39 | | -sources. |
40 | | -
|
41 | | -Options: |
42 | | -
|
43 | | - source_dir: |
44 | | - This is the directory holding .proto files to be processed. |
45 | | -
|
46 | | - The default behavior is to generate sources for all .proto files found |
47 | | - under `source_dir`, recursively. This behavior can be controlled with |
48 | | - options below. |
49 | | -
|
50 | | - proto_root_path: |
51 | | - This is the root path for resolving imports in source .proto files. |
52 | | -
|
53 | | - The default is the shortest prefix of `source_dir` among: |
54 | | - [source_dir] + self.extra_proto_paths |
55 | | -
|
56 | | - extra_proto_paths: |
57 | | - Specifies additional paths that should be used to find imports, in |
58 | | - addition to `source_dir`. |
59 | | -
|
60 | | - This option can be used to specify the path to other protobuf sources, |
61 | | - which are imported by files under `source_dir`. No Python code will be |
62 | | - generated for .proto files under `extra_proto_paths`. |
63 | | -
|
64 | | - output_dir: |
65 | | - Specifies where generated code should be placed. |
66 | | -
|
67 | | - Typically, this should be the root package that generated Python modules |
68 | | - should be below. |
69 | | -
|
70 | | - The generated files will be named according to the relative source paths |
71 | | - under `proto_root_path`. For example, this source .proto file: |
72 | | - ${proto_root_path}/subdir/message.proto |
73 | | - will correspond to this generated Python module: |
74 | | - ${output_dir}/subdir/message_pb2.py |
75 | | -
|
76 | | - proto_files: |
77 | | - Specific .proto files can be specified for generating code, instead of |
78 | | - searching for all .proto files under `source_path`. |
79 | | -
|
80 | | - These paths are relative to `source_dir`. For example, to generate code |
81 | | - for just ${source_dir}/subdir/message.proto, specify |
82 | | - ['subdir/message.proto']. |
83 | | -
|
84 | | - protoc: |
85 | | - By default, the protoc binary (the Protobuf compiler) is found by |
86 | | - searching the environment path. To use a specific protoc binary, its |
87 | | - path can be specified. |
88 | | -
|
89 | | - recurse: |
90 | | - If `proto_files` are not specified, then the default behavior is to |
91 | | - search `source_dir` recursively. This option controls the recursive |
92 | | - search; if it is False, only .proto files immediately under `source_dir` |
93 | | - will be used to generate sources. |
94 | | -
|
95 | | -""" |
| 31 | +"""Setuptools/distutils extension for generating Python protobuf code.""" |
96 | 32 |
|
97 | 33 | __author__ = '[email protected] (David L. Jones)' |
98 | 34 |
|
|
0 commit comments