diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-03-07 11:26:23 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-03-07 22:19:48 +0000 |
commit | 42bdba80f744840ed281770624019a8907793bf3 (patch) | |
tree | 276246a929acd2f6ef86521d0605159bdb777837 | |
parent | 2cbf2fb05ea0468a6faf8df575f32d1277109527 (diff) |
vpp_papi: Adjust aenum import for python3.
The stdlib introduced IntEnum in python 3.4 and IntFlag in python 3.6.
Change-Id: I3ac278a9d5a97eefa9fc4f1491f0cd030e40c3b2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r-- | src/vpp-api/python/setup.py | 2 | ||||
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_serializer.py | 13 | ||||
-rw-r--r-- | test/requirements.txt | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/vpp-api/python/setup.py b/src/vpp-api/python/setup.py index b5fc11a590a..c8321320c73 100644 --- a/src/vpp-api/python/setup.py +++ b/src/vpp-api/python/setup.py @@ -13,7 +13,7 @@ # limitations under the License. import sys -stdlib_enum = sys.version_info >= (3, 4) +stdlib_enum = sys.version_info >= (3, 6) try: from setuptools import setup, find_packages diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py index e6012018f08..1e59e366a8f 100644 --- a/src/vpp-api/python/vpp_papi/vpp_serializer.py +++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py @@ -16,10 +16,17 @@ import struct import collections import sys -if sys.version[0] == '2': - from aenum import IntEnum, IntFlag + +if sys.version_info <= (3, 4): + from aenum import IntEnum else: - from enum import IntEnum, IntFlag + from enum import IntEnum + +if sys.version_info <= (3, 6): + from aenum import IntFlag +else: + from enum import IntFlag + import logging from . import vpp_format import ipaddress diff --git a/test/requirements.txt b/test/requirements.txt index b05cc74bc1a..e4344d6928f 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,3 +1,4 @@ +aenum>= 2.1.2; python_version < '3.6' # BSD cffi # MIT cryptography!=2.0 # BSD/Apache-2.0 faulthandler; python_version < '3.3' # # BSD License (2 clause) |