Make generator print errors to stderr.
Otherwise they won't be visible when run as a protoc plugin.
This commit is contained in:
@@ -3,28 +3,30 @@
|
|||||||
'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
|
'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
|
||||||
nanopb_version = "nanopb-0.2.5-dev"
|
nanopb_version = "nanopb-0.2.5-dev"
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import google, distutils.util # bbfreeze seems to need these
|
import google, distutils.util # bbfreeze seems to need these
|
||||||
import google.protobuf.text_format as text_format
|
import google.protobuf.text_format as text_format
|
||||||
except:
|
except:
|
||||||
print
|
sys.stderr.write('''
|
||||||
print "*************************************************************"
|
*************************************************************
|
||||||
print "*** Could not import the Google protobuf Python libraries ***"
|
*** Could not import the Google protobuf Python libraries ***
|
||||||
print "*** Try installing package 'python-protobuf' or similar. ***"
|
*** Try installing package 'python-protobuf' or similar. ***
|
||||||
print "*************************************************************"
|
*************************************************************
|
||||||
print
|
''' + '\n')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import proto.nanopb_pb2 as nanopb_pb2
|
import proto.nanopb_pb2 as nanopb_pb2
|
||||||
import proto.descriptor_pb2 as descriptor
|
import proto.descriptor_pb2 as descriptor
|
||||||
except:
|
except:
|
||||||
print
|
sys.stderr.write('''
|
||||||
print "********************************************************************"
|
********************************************************************
|
||||||
print "*** Failed to import the protocol definitions for generator. ***"
|
*** Failed to import the protocol definitions for generator. ***
|
||||||
print "*** You have to run 'make' in the nanopb/generator/proto folder. ***"
|
*** You have to run 'make' in the nanopb/generator/proto folder. ***
|
||||||
print "********************************************************************"
|
********************************************************************
|
||||||
print
|
''' + '\n')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user