Skip to content

Commit 7e23e63

Browse files
[y_cable] Skip ImportError in y_cable.py (#154)
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.
1 parent e6557ac commit 7e23e63

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sonic_y_cable/y_cable.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

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

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

0 commit comments

Comments
 (0)