OLD | NEW |
1 # Protocol Buffers - Google's data interchange format | 1 # Protocol Buffers - Google's data interchange format |
2 # Copyright 2008 Google Inc. All rights reserved. | 2 # Copyright 2008 Google Inc. All rights reserved. |
3 # http://code.google.com/p/protobuf/ | 3 # http://code.google.com/p/protobuf/ |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 18 matching lines...) Expand all Loading... |
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 """Determine which implementation of the protobuf API is used in this process. | 31 """Determine which implementation of the protobuf API is used in this process. |
32 """ | 32 """ |
33 | 33 |
34 import os | 34 import os |
35 import sys | 35 import sys |
36 | 36 |
37 try: | 37 try: |
38 # pylint: disable=g-import-not-at-top | 38 # pylint: disable=g-import-not-at-top |
39 from google.protobuf.internal import _api_implementation | 39 from protobuf26.internal import _api_implementation |
40 # The compile-time constants in the _api_implementation module can be used to | 40 # The compile-time constants in the _api_implementation module can be used to |
41 # switch to a certain implementation of the Python API at build time. | 41 # switch to a certain implementation of the Python API at build time. |
42 _api_version = _api_implementation.api_version | 42 _api_version = _api_implementation.api_version |
43 del _api_implementation | 43 del _api_implementation |
44 except ImportError: | 44 except ImportError: |
45 _api_version = 0 | 45 _api_version = 0 |
46 | 46 |
47 _default_implementation_type = ( | 47 _default_implementation_type = ( |
48 'python' if _api_version == 0 else 'cpp') | 48 'python' if _api_version == 0 else 'cpp') |
49 _default_version_str = ( | 49 _default_version_str = ( |
(...skipping 30 matching lines...) Expand all Loading... |
80 # implementation of the API is in use. Note that there is no guarantee | 80 # implementation of the API is in use. Note that there is no guarantee |
81 # that differences between APIs will be maintained. | 81 # that differences between APIs will be maintained. |
82 # Please don't use this function if possible. | 82 # Please don't use this function if possible. |
83 def Type(): | 83 def Type(): |
84 return _implementation_type | 84 return _implementation_type |
85 | 85 |
86 | 86 |
87 # See comment on 'Type' above. | 87 # See comment on 'Type' above. |
88 def Version(): | 88 def Version(): |
89 return _implementation_version | 89 return _implementation_version |
OLD | NEW |