Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2020-06-18 13:36:09 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2020-06-18 13:39:30 +0300
commitbf1eb547d76d416c83ec3c3ca2d8f8f6fdc2770b (patch)
treef994b75d8ec77595ec5107b0818356571752d0d9 /generator/nanopb_generator.py2
parent040cd30712a4e8a62c0b36a39e776e18e93d0052 (diff)
Change generator to use Python 3 by default (#441, #509).
This may break things for users that have python-protobuf installed only for Python 2. Easiest fix is to just install python3-protobuf. After much consideration, I think making the change now will make life easiest for most users. There are now alternative files that can be used if only Python 2 is available, see migration.rst.
Diffstat (limited to 'generator/nanopb_generator.py2')
-rwxr-xr-xgenerator/nanopb_generator.py213
1 files changed, 13 insertions, 0 deletions
diff --git a/generator/nanopb_generator.py2 b/generator/nanopb_generator.py2
new file mode 100755
index 0000000..0469461
--- /dev/null
+++ b/generator/nanopb_generator.py2
@@ -0,0 +1,13 @@
+#!/usr/bin/env python2
+# This file is a wrapper around nanopb_generator.py in case you want to run
+# it with Python 2 instead of default Python 3. This only exists for backwards
+# compatibility, do not use for new projects.
+
+from nanopb_generator import *
+
+if __name__ == '__main__':
+ # Check if we are running as a plugin under protoc
+ if 'protoc-gen-' in sys.argv[0] or '--protoc-plugin' in sys.argv:
+ main_plugin()
+ else:
+ main_cli()