nanopb 0.4.9.dev1465__tar.gz → 0.4.9.dev1473__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/PKG-INFO +1 -1
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/nanopb_generator.py +6 -2
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/__init__.py +22 -28
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/__pycache__/__init__.cpython-38.pyc +0 -0
- nanopb-0.4.9.dev1473/nanopb/generator/proto/__pycache__/_utils.cpython-38.pyc +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/_utils.py +7 -2
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/nanopb.proto +5 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/nanopb_pb2.py +13 -13
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/pyproject.toml +1 -1
- nanopb-0.4.9.dev1465/nanopb/generator/proto/__pycache__/_utils.cpython-38.pyc +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/README.md +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/__init__.py +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/__init__.py +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/nanopb_generator +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/nanopb_generator.bat +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/nanopb_generator.py2 +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/platformio_generator.py +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/Makefile +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/proto/google/protobuf/descriptor.proto +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/protoc +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/protoc-gen-nanopb +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/protoc-gen-nanopb-py2 +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/protoc-gen-nanopb.bat +0 -0
- {nanopb-0.4.9.dev1465 → nanopb-0.4.9.dev1473}/nanopb/generator/protoc.bat +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nanopb
|
|
3
|
-
Version: 0.4.9.
|
|
3
|
+
Version: 0.4.9.dev1473
|
|
4
4
|
Summary: Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system.
|
|
5
5
|
Home-page: https://jpa.kapsi.fi/nanopb/
|
|
6
6
|
License: Zlib
|
|
@@ -615,6 +615,9 @@ class Field(ProtoElement):
|
|
|
615
615
|
self.default = desc.default_value
|
|
616
616
|
|
|
617
617
|
# Check field rules, i.e. required/optional/repeated.
|
|
618
|
+
if field_options.HasField("label_override"):
|
|
619
|
+
desc.label = field_options.label_override
|
|
620
|
+
|
|
618
621
|
can_be_static = True
|
|
619
622
|
if desc.label == FieldD.LABEL_REPEATED:
|
|
620
623
|
self.rules = 'REPEATED'
|
|
@@ -625,6 +628,9 @@ class Field(ProtoElement):
|
|
|
625
628
|
if field_options.fixed_count:
|
|
626
629
|
self.rules = 'FIXARRAY'
|
|
627
630
|
|
|
631
|
+
elif desc.label == FieldD.LABEL_REQUIRED:
|
|
632
|
+
# We allow LABEL_REQUIRED using label_override even for proto3 (see #962)
|
|
633
|
+
self.rules = 'REQUIRED'
|
|
628
634
|
elif field_options.proto3:
|
|
629
635
|
if desc.type == FieldD.TYPE_MESSAGE and not field_options.proto3_singular_msgs:
|
|
630
636
|
# In most other protobuf libraries proto3 submessages have
|
|
@@ -636,8 +642,6 @@ class Field(ProtoElement):
|
|
|
636
642
|
else:
|
|
637
643
|
# Proto3 singular fields (without has_field)
|
|
638
644
|
self.rules = 'SINGULAR'
|
|
639
|
-
elif desc.label == FieldD.LABEL_REQUIRED:
|
|
640
|
-
self.rules = 'REQUIRED'
|
|
641
645
|
elif desc.label == FieldD.LABEL_OPTIONAL:
|
|
642
646
|
self.rules = 'OPTIONAL'
|
|
643
647
|
else:
|
|
@@ -67,14 +67,11 @@ def load_nanopb_pb2():
|
|
|
67
67
|
# If the value of the $NANOPB_PB2_TEMP_DIR exists as a directory, it is used instead
|
|
68
68
|
# of system temp folder.
|
|
69
69
|
|
|
70
|
-
build_error = None
|
|
71
|
-
proto_ok = False
|
|
72
70
|
tmpdir = os.getenv("NANOPB_PB2_TEMP_DIR")
|
|
73
71
|
temporary_only = (tmpdir is not None)
|
|
74
72
|
dirname = os.path.dirname(__file__)
|
|
75
73
|
protosrc = os.path.join(dirname, "nanopb.proto")
|
|
76
74
|
protodst = os.path.join(dirname, "nanopb_pb2.py")
|
|
77
|
-
proto_ok = False
|
|
78
75
|
|
|
79
76
|
if tmpdir is not None and not os.path.isdir(tmpdir):
|
|
80
77
|
tmpdir = None # Use system-wide temp dir
|
|
@@ -84,16 +81,14 @@ def load_nanopb_pb2():
|
|
|
84
81
|
# Don't attempt to autogenerate nanopb_pb2.py, external build rules
|
|
85
82
|
# should have already done so.
|
|
86
83
|
import nanopb_pb2 as nanopb_pb2_mod
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
return nanopb_pb2_mod
|
|
85
|
+
|
|
86
|
+
if os.path.isfile(protosrc):
|
|
89
87
|
src_date = os.path.getmtime(protosrc)
|
|
90
|
-
if
|
|
91
|
-
# Outdated, rebuild
|
|
92
|
-
proto_ok = False
|
|
93
|
-
else:
|
|
88
|
+
if os.path.isfile(protodst) and os.path.getmtime(protodst) >= src_date:
|
|
94
89
|
try:
|
|
95
90
|
from . import nanopb_pb2 as nanopb_pb2_mod
|
|
96
|
-
|
|
91
|
+
return nanopb_pb2_mod
|
|
97
92
|
except Exception as e:
|
|
98
93
|
sys.stderr.write("Failed to import nanopb_pb2.py: " + str(e) + "\n"
|
|
99
94
|
"Will automatically attempt to rebuild this.\n"
|
|
@@ -101,34 +96,33 @@ def load_nanopb_pb2():
|
|
|
101
96
|
print_versions()
|
|
102
97
|
|
|
103
98
|
# Try to rebuild into generator/proto directory
|
|
104
|
-
if not
|
|
105
|
-
|
|
99
|
+
if not temporary_only:
|
|
100
|
+
build_nanopb_proto(protosrc, dirname)
|
|
106
101
|
|
|
107
102
|
try:
|
|
108
103
|
from . import nanopb_pb2 as nanopb_pb2_mod
|
|
104
|
+
return nanopb_pb2_mod
|
|
109
105
|
except:
|
|
110
106
|
sys.stderr.write("Failed to import generator/proto/nanopb_pb2.py:\n")
|
|
111
107
|
sys.stderr.write(traceback.format_exc() + "\n")
|
|
112
108
|
|
|
113
109
|
# Try to rebuild into temporary directory
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
proto_ok = build_nanopb_proto(protosrc, protodir)
|
|
110
|
+
with TemporaryDirectory(prefix = 'nanopb-', dir = tmpdir) as protodir:
|
|
111
|
+
build_nanopb_proto(protosrc, protodir)
|
|
117
112
|
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
if protodir not in sys.path:
|
|
114
|
+
sys.path.insert(0, protodir)
|
|
120
115
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
try:
|
|
117
|
+
import nanopb_pb2 as nanopb_pb2_mod
|
|
118
|
+
return nanopb_pb2_mod
|
|
119
|
+
except:
|
|
120
|
+
sys.stderr.write("Failed to import %s/nanopb_pb2.py:\n" % protodir)
|
|
121
|
+
sys.stderr.write(traceback.format_exc() + "\n")
|
|
126
122
|
|
|
127
123
|
# If everything fails
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
sys.exit(1)
|
|
124
|
+
sys.stderr.write("\n\nGenerating nanopb_pb2.py failed.\n")
|
|
125
|
+
sys.stderr.write("Make sure that a protoc generator is available and matches python-protobuf version.\n")
|
|
126
|
+
print_versions()
|
|
127
|
+
sys.exit(1)
|
|
133
128
|
|
|
134
|
-
return nanopb_pb2_mod
|
|
Binary file
|
|
@@ -2,14 +2,19 @@ import sys
|
|
|
2
2
|
import subprocess
|
|
3
3
|
import os.path
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import traceback
|
|
6
|
+
|
|
7
|
+
def has_grpcio_protoc(verbose = False):
|
|
6
8
|
# type: () -> bool
|
|
7
9
|
""" checks if grpcio-tools protoc is installed"""
|
|
8
10
|
|
|
9
11
|
try:
|
|
10
12
|
import grpc_tools.protoc
|
|
11
13
|
except ImportError:
|
|
14
|
+
if verbose:
|
|
15
|
+
sys.stderr.write("Failed to import grpc_tools: %s\n" % traceback.format_exc())
|
|
12
16
|
return False
|
|
17
|
+
|
|
13
18
|
return True
|
|
14
19
|
|
|
15
20
|
def get_proto_builtin_include_path():
|
|
@@ -64,7 +69,7 @@ def invoke_protoc(argv):
|
|
|
64
69
|
|
|
65
70
|
def print_versions():
|
|
66
71
|
try:
|
|
67
|
-
if has_grpcio_protoc():
|
|
72
|
+
if has_grpcio_protoc(verbose = True):
|
|
68
73
|
import grpc_tools.protoc
|
|
69
74
|
sys.stderr.write("Using grpcio-tools protoc from " + grpc_tools.protoc.__file__ + "\n")
|
|
70
75
|
else:
|
|
@@ -143,6 +143,11 @@ message NanoPBOptions {
|
|
|
143
143
|
// Override type of the field in generated C code. Only to be used with related field types
|
|
144
144
|
optional google.protobuf.FieldDescriptorProto.Type type_override = 27;
|
|
145
145
|
|
|
146
|
+
// Override of the label of the field (see FieldDescriptorProto.Label). Can be used to create
|
|
147
|
+
// fields which nanopb considers required in proto3, or whether nanopb treats the field as
|
|
148
|
+
// optional/required/repeated.
|
|
149
|
+
optional google.protobuf.FieldDescriptorProto.Label label_override = 31;
|
|
150
|
+
|
|
146
151
|
// Due to historical reasons, nanopb orders fields in structs by their tag number
|
|
147
152
|
// instead of the order in .proto. Set this to false to keep the .proto order.
|
|
148
153
|
// The default value will probably change to false in nanopb-0.5.0.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# source: nanopb.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
4
|
+
# Protobuf Python Version: 5.26.1
|
|
5
5
|
"""Generated protocol buffer code."""
|
|
6
6
|
from google.protobuf import descriptor as _descriptor
|
|
7
7
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -15,22 +15,22 @@ _sym_db = _symbol_database.Default()
|
|
|
15
15
|
from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cnanopb.proto\x1a google/protobuf/descriptor.proto\"\
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cnanopb.proto\x1a google/protobuf/descriptor.proto\"\xfe\x07\n\rNanoPBOptions\x12\x10\n\x08max_size\x18\x01 \x01(\x05\x12\x12\n\nmax_length\x18\x0e \x01(\x05\x12\x11\n\tmax_count\x18\x02 \x01(\x05\x12&\n\x08int_size\x18\x07 \x01(\x0e\x32\x08.IntSize:\nIS_DEFAULT\x12$\n\x04type\x18\x03 \x01(\x0e\x32\n.FieldType:\nFT_DEFAULT\x12\x18\n\nlong_names\x18\x04 \x01(\x08:\x04true\x12\x1c\n\rpacked_struct\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1a\n\x0bpacked_enum\x18\n \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0cskip_message\x18\x06 \x01(\x08:\x05\x66\x61lse\x12\x18\n\tno_unions\x18\x08 \x01(\x08:\x05\x66\x61lse\x12\r\n\x05msgid\x18\t \x01(\r\x12\x1e\n\x0f\x61nonymous_oneof\x18\x0b \x01(\x08:\x05\x66\x61lse\x12\x15\n\x06proto3\x18\x0c \x01(\x08:\x05\x66\x61lse\x12#\n\x14proto3_singular_msgs\x18\x15 \x01(\x08:\x05\x66\x61lse\x12\x1d\n\x0e\x65num_to_string\x18\r \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0c\x66ixed_length\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x1a\n\x0b\x66ixed_count\x18\x10 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0fsubmsg_callback\x18\x16 \x01(\x08:\x05\x66\x61lse\x12/\n\x0cmangle_names\x18\x11 \x01(\x0e\x32\x11.TypenameMangling:\x06M_NONE\x12(\n\x11\x63\x61llback_datatype\x18\x12 \x01(\t:\rpb_callback_t\x12\x34\n\x11\x63\x61llback_function\x18\x13 \x01(\t:\x19pb_default_field_callback\x12\x30\n\x0e\x64\x65scriptorsize\x18\x14 \x01(\x0e\x32\x0f.DescriptorSize:\x07\x44S_AUTO\x12\x1a\n\x0b\x64\x65\x66\x61ult_has\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x0f\n\x07include\x18\x18 \x03(\t\x12\x0f\n\x07\x65xclude\x18\x1a \x03(\t\x12\x0f\n\x07package\x18\x19 \x01(\t\x12\x41\n\rtype_override\x18\x1b \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x43\n\x0elabel_override\x18\x1f \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x19\n\x0bsort_by_tag\x18\x1c \x01(\x08:\x04true\x12.\n\rfallback_type\x18\x1d \x01(\x0e\x32\n.FieldType:\x0b\x46T_CALLBACK\x12\x13\n\x0binitializer\x18\x1e \x01(\t*i\n\tFieldType\x12\x0e\n\nFT_DEFAULT\x10\x00\x12\x0f\n\x0b\x46T_CALLBACK\x10\x01\x12\x0e\n\nFT_POINTER\x10\x04\x12\r\n\tFT_STATIC\x10\x02\x12\r\n\tFT_IGNORE\x10\x03\x12\r\n\tFT_INLINE\x10\x05*D\n\x07IntSize\x12\x0e\n\nIS_DEFAULT\x10\x00\x12\x08\n\x04IS_8\x10\x08\x12\t\n\x05IS_16\x10\x10\x12\t\n\x05IS_32\x10 \x12\t\n\x05IS_64\x10@*Z\n\x10TypenameMangling\x12\n\n\x06M_NONE\x10\x00\x12\x13\n\x0fM_STRIP_PACKAGE\x10\x01\x12\r\n\tM_FLATTEN\x10\x02\x12\x16\n\x12M_PACKAGE_INITIALS\x10\x03*E\n\x0e\x44\x65scriptorSize\x12\x0b\n\x07\x44S_AUTO\x10\x00\x12\x08\n\x04\x44S_1\x10\x01\x12\x08\n\x04\x44S_2\x10\x02\x12\x08\n\x04\x44S_4\x10\x04\x12\x08\n\x04\x44S_8\x10\x08:E\n\x0enanopb_fileopt\x12\x1c.google.protobuf.FileOptions\x18\xf2\x07 \x01(\x0b\x32\x0e.NanoPBOptions:G\n\rnanopb_msgopt\x12\x1f.google.protobuf.MessageOptions\x18\xf2\x07 \x01(\x0b\x32\x0e.NanoPBOptions:E\n\x0enanopb_enumopt\x12\x1c.google.protobuf.EnumOptions\x18\xf2\x07 \x01(\x0b\x32\x0e.NanoPBOptions:>\n\x06nanopb\x12\x1d.google.protobuf.FieldOptions\x18\xf2\x07 \x01(\x0b\x32\x0e.NanoPBOptionsB\x1a\n\x18\x66i.kapsi.koti.jpa.nanopb')
|
|
19
19
|
|
|
20
20
|
_globals = globals()
|
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
22
22
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'nanopb_pb2', _globals)
|
|
23
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
24
|
-
_globals['DESCRIPTOR'].
|
|
23
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
24
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
25
25
|
_globals['DESCRIPTOR']._serialized_options = b'\n\030fi.kapsi.koti.jpa.nanopb'
|
|
26
|
-
_globals['_FIELDTYPE']._serialized_start=
|
|
27
|
-
_globals['_FIELDTYPE']._serialized_end=
|
|
28
|
-
_globals['_INTSIZE']._serialized_start=
|
|
29
|
-
_globals['_INTSIZE']._serialized_end=
|
|
30
|
-
_globals['_TYPENAMEMANGLING']._serialized_start=
|
|
31
|
-
_globals['_TYPENAMEMANGLING']._serialized_end=
|
|
32
|
-
_globals['_DESCRIPTORSIZE']._serialized_start=
|
|
33
|
-
_globals['_DESCRIPTORSIZE']._serialized_end=
|
|
26
|
+
_globals['_FIELDTYPE']._serialized_start=1075
|
|
27
|
+
_globals['_FIELDTYPE']._serialized_end=1180
|
|
28
|
+
_globals['_INTSIZE']._serialized_start=1182
|
|
29
|
+
_globals['_INTSIZE']._serialized_end=1250
|
|
30
|
+
_globals['_TYPENAMEMANGLING']._serialized_start=1252
|
|
31
|
+
_globals['_TYPENAMEMANGLING']._serialized_end=1342
|
|
32
|
+
_globals['_DESCRIPTORSIZE']._serialized_start=1344
|
|
33
|
+
_globals['_DESCRIPTORSIZE']._serialized_end=1413
|
|
34
34
|
_globals['_NANOPBOPTIONS']._serialized_start=51
|
|
35
|
-
_globals['_NANOPBOPTIONS']._serialized_end=
|
|
35
|
+
_globals['_NANOPBOPTIONS']._serialized_end=1073
|
|
36
36
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "nanopb"
|
|
3
|
-
version = "0.4.9-
|
|
3
|
+
version = "0.4.9-dev1473"
|
|
4
4
|
description = "Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system."
|
|
5
5
|
authors = ["Petteri Aimonen <jpa@npb.mail.kapsi.fi>"]
|
|
6
6
|
license = "Zlib"
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|