nanopb 1.0.0.dev1496__tar.gz → 1.0.0.dev1499__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-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/PKG-INFO +2 -8
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/nanopb_generator.py +15 -21
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/__init__.py +1 -17
- nanopb-1.0.0.dev1499/nanopb/generator/proto/__pycache__/__init__.cpython-38.pyc +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/__pycache__/_utils.cpython-38.pyc +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/pyproject.toml +2 -2
- nanopb-1.0.0.dev1496/nanopb/generator/nanopb_generator.py2 +0 -13
- nanopb-1.0.0.dev1496/nanopb/generator/proto/__pycache__/__init__.cpython-38.pyc +0 -0
- nanopb-1.0.0.dev1496/nanopb/generator/protoc-gen-nanopb-py2 +0 -16
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/README.md +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/__init__.py +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/__init__.py +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/nanopb_generator +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/nanopb_generator.bat +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/platformio_generator.py +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/Makefile +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/_utils.py +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/google/protobuf/descriptor.proto +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/nanopb.proto +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/proto/nanopb_pb2.py +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/protoc +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/protoc-gen-nanopb +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/protoc-gen-nanopb.bat +0 -0
- {nanopb-1.0.0.dev1496 → nanopb-1.0.0.dev1499}/nanopb/generator/protoc.bat +0 -0
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nanopb
|
|
3
|
-
Version: 1.0.0.
|
|
3
|
+
Version: 1.0.0.dev1499
|
|
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
|
|
7
7
|
Keywords: protobuf,protoc
|
|
8
8
|
Author: Petteri Aimonen
|
|
9
9
|
Author-email: jpa@npb.mail.kapsi.fi
|
|
10
|
-
Requires-Python: >=
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
11
|
Classifier: License :: OSI Approved
|
|
12
|
-
Classifier: Programming Language :: Python :: 2
|
|
13
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
14
12
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
19
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
20
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -34,8 +34,8 @@ try:
|
|
|
34
34
|
import google.protobuf.text_format as text_format
|
|
35
35
|
import google.protobuf.descriptor_pb2 as descriptor
|
|
36
36
|
import google.protobuf.compiler.plugin_pb2 as plugin_pb2
|
|
37
|
-
import google.protobuf.reflection as reflection
|
|
38
37
|
import google.protobuf.descriptor
|
|
38
|
+
import google.protobuf.message_factory as message_factory
|
|
39
39
|
except:
|
|
40
40
|
sys.stderr.write('''
|
|
41
41
|
**********************************************************************
|
|
@@ -47,6 +47,15 @@ except:
|
|
|
47
47
|
''' + '\n')
|
|
48
48
|
raise
|
|
49
49
|
|
|
50
|
+
# GetMessageClass() is used by modern python-protobuf (around 5.x onwards)
|
|
51
|
+
# Retain compatibility with older python-protobuf versions.
|
|
52
|
+
try:
|
|
53
|
+
import google.protobuf.message_factory as message_factory
|
|
54
|
+
GetMessageClass = message_factory.GetMessageClass
|
|
55
|
+
except AttributeError:
|
|
56
|
+
import google.protobuf.reflection as reflection
|
|
57
|
+
GetMessageClass = reflection.MakeClass
|
|
58
|
+
|
|
50
59
|
# Depending on how this script is run, we may or may not have PEP366 package name
|
|
51
60
|
# available for relative imports.
|
|
52
61
|
if not __package__:
|
|
@@ -194,27 +203,12 @@ class Globals:
|
|
|
194
203
|
protoc_insertion_points = False
|
|
195
204
|
naming_style = NamingStyle()
|
|
196
205
|
|
|
197
|
-
# String types and file encoding for Python2 UTF-8 support
|
|
198
|
-
if sys.version_info.major == 2:
|
|
199
|
-
import codecs
|
|
200
|
-
open = codecs.open
|
|
201
|
-
strtypes = (unicode, str)
|
|
202
|
-
|
|
203
|
-
def str(x):
|
|
204
|
-
try:
|
|
205
|
-
return strtypes[1](x)
|
|
206
|
-
except UnicodeEncodeError:
|
|
207
|
-
return strtypes[0](x)
|
|
208
|
-
else:
|
|
209
|
-
strtypes = (str, )
|
|
210
|
-
|
|
211
|
-
|
|
212
206
|
class Names:
|
|
213
207
|
'''Keeps a set of nested names and formats them to C identifier.'''
|
|
214
208
|
def __init__(self, parts = ()):
|
|
215
209
|
if isinstance(parts, Names):
|
|
216
210
|
parts = parts.parts
|
|
217
|
-
elif isinstance(parts,
|
|
211
|
+
elif isinstance(parts, str):
|
|
218
212
|
parts = (parts,)
|
|
219
213
|
self.parts = tuple(parts)
|
|
220
214
|
|
|
@@ -228,7 +222,7 @@ class Names:
|
|
|
228
222
|
return 'Names(%s)' % ','.join("'%s'" % x for x in self.parts)
|
|
229
223
|
|
|
230
224
|
def __add__(self, other):
|
|
231
|
-
if isinstance(other,
|
|
225
|
+
if isinstance(other, str):
|
|
232
226
|
return Names(self.parts + (other,))
|
|
233
227
|
elif isinstance(other, Names):
|
|
234
228
|
return Names(self.parts + other.parts)
|
|
@@ -274,7 +268,7 @@ class EncodedSize:
|
|
|
274
268
|
self.symbols = value.symbols
|
|
275
269
|
self.declarations = value.declarations
|
|
276
270
|
self.required_defines = value.required_defines
|
|
277
|
-
elif isinstance(value,
|
|
271
|
+
elif isinstance(value, (str, Names)):
|
|
278
272
|
self.symbols = [str(value)]
|
|
279
273
|
self.value = 0
|
|
280
274
|
self.declarations = []
|
|
@@ -288,7 +282,7 @@ class EncodedSize:
|
|
|
288
282
|
def __add__(self, other):
|
|
289
283
|
if isinstance(other, int):
|
|
290
284
|
return EncodedSize(self.value + other, self.symbols, self.declarations, self.required_defines)
|
|
291
|
-
elif isinstance(other,
|
|
285
|
+
elif isinstance(other, (str, Names)):
|
|
292
286
|
return EncodedSize(self.value, self.symbols + [str(other)], self.declarations, self.required_defines + [str(other)])
|
|
293
287
|
elif isinstance(other, EncodedSize):
|
|
294
288
|
return EncodedSize(self.value + other.value, self.symbols + other.symbols,
|
|
@@ -1689,7 +1683,7 @@ class Message(ProtoElement):
|
|
|
1689
1683
|
optional_only.name += str(id(self))
|
|
1690
1684
|
|
|
1691
1685
|
desc = google.protobuf.descriptor.MakeDescriptor(optional_only)
|
|
1692
|
-
msg =
|
|
1686
|
+
msg = GetMessageClass(desc)()
|
|
1693
1687
|
|
|
1694
1688
|
for field in optional_only.field:
|
|
1695
1689
|
if field.type == FieldD.TYPE_STRING:
|
|
@@ -7,25 +7,9 @@ import sys
|
|
|
7
7
|
import tempfile
|
|
8
8
|
import shutil
|
|
9
9
|
import traceback
|
|
10
|
+
from tempfile import TemporaryDirectory
|
|
10
11
|
from ._utils import has_grpcio_protoc, invoke_protoc, print_versions
|
|
11
12
|
|
|
12
|
-
# Compatibility layer to make TemporaryDirectory() available on Python 2.
|
|
13
|
-
try:
|
|
14
|
-
from tempfile import TemporaryDirectory
|
|
15
|
-
except ImportError:
|
|
16
|
-
class TemporaryDirectory:
|
|
17
|
-
'''TemporaryDirectory fallback for Python 2'''
|
|
18
|
-
def __init__(self, prefix = 'tmp', dir = None):
|
|
19
|
-
self.prefix = prefix
|
|
20
|
-
self.dir = dir
|
|
21
|
-
|
|
22
|
-
def __enter__(self):
|
|
23
|
-
self.dir = tempfile.mkdtemp(prefix = self.prefix, dir = self.dir)
|
|
24
|
-
return self.dir
|
|
25
|
-
|
|
26
|
-
def __exit__(self, *args):
|
|
27
|
-
shutil.rmtree(self.dir)
|
|
28
|
-
|
|
29
13
|
def build_nanopb_proto(protosrc, dirname):
|
|
30
14
|
'''Try to build a .proto file for python-protobuf.
|
|
31
15
|
Returns True if successful.
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "nanopb"
|
|
3
|
-
version = "1.0.0-
|
|
3
|
+
version = "1.0.0-dev1499"
|
|
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"
|
|
@@ -17,7 +17,7 @@ nanopb_generator = "nanopb.generator.nanopb_generator:main_cli"
|
|
|
17
17
|
protoc-gen-nanopb = "nanopb.generator.nanopb_generator:main_plugin"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
|
-
python = ">=
|
|
20
|
+
python = ">=3.8"
|
|
21
21
|
protobuf = ">=3.19"
|
|
22
22
|
grpcio-tools = {version=">=1.46.0", optional=true}
|
|
23
23
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python2
|
|
2
|
-
# This file is a wrapper around nanopb_generator.py in case you want to run
|
|
3
|
-
# it with Python 2 instead of default Python 3. This only exists for backwards
|
|
4
|
-
# compatibility, do not use for new projects.
|
|
5
|
-
|
|
6
|
-
from nanopb_generator import *
|
|
7
|
-
|
|
8
|
-
if __name__ == '__main__':
|
|
9
|
-
# Check if we are running as a plugin under protoc
|
|
10
|
-
if 'protoc-gen-' in sys.argv[0] or '--protoc-plugin' in sys.argv:
|
|
11
|
-
main_plugin()
|
|
12
|
-
else:
|
|
13
|
-
main_cli()
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
# This file is used to invoke nanopb_generator.py2 as a plugin
|
|
4
|
-
# to protoc on Linux and other *nix-style systems.
|
|
5
|
-
#
|
|
6
|
-
# The difference from protoc-gen-nanopb is that this executes with Python 2.
|
|
7
|
-
#
|
|
8
|
-
# Use it like this:
|
|
9
|
-
# protoc --plugin=protoc-gen-nanopb=..../protoc-gen-nanopb-py2 --nanopb_out=dir foo.proto
|
|
10
|
-
#
|
|
11
|
-
# Note that if you use the binary package of nanopb, the protoc
|
|
12
|
-
# path is already set up properly and there is no need to give
|
|
13
|
-
# --plugin= on the command line.
|
|
14
|
-
|
|
15
|
-
MYPATH=$(dirname "$0")
|
|
16
|
-
exec "$MYPATH/nanopb_generator.py2" --protoc-plugin
|
|
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
|
|
File without changes
|