Skip to content

Commit

Permalink
[y_cable] Skip ImportError in y_cable.py (sonic-net#154)
Browse files Browse the repository at this point in the history
When build python3 xcvrd, it tries to do basic check which will import this y_cable.py. However, not all platform supports python3 API now, so it could cause an issue when importing sonic_platform.platform

We skip the ImportError here to make the builder happy. And this is safe because:
- If any python package is not available, there will be exception when use it
- Vendors know their platform API version, they are responsible to use correct python version when importing this file.
  • Loading branch information
Junchao-Mellanox authored Dec 15, 2020
1 parent e6557ac commit 7e23e63
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sonic_y_cable/y_cable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

try:
import struct

import sonic_platform.platform
from sonic_py_common import logger

import sonic_platform.platform
except ImportError as e:
raise ImportError(str(e) + " - required module not found")
# When build python3 xcvrd, it tries to do basic check which will import this file. However,
# not all platform supports python3 API now, so it could cause an issue when importing
# sonic_platform.platform. We skip the ImportError here. This is safe because:
# 1. If any python package is not available, there will be exception when use it
# 2. Vendors know their platform API version, they are responsible to use correct python
# version when importing this file.
pass

# definitions of the offset with width accommodated for values
# of MUX register specs of upper page 0x04 starting at 640
Expand Down

0 comments on commit 7e23e63

Please sign in to comment.