fix(deps): 锁定cryptography版本以修复CI环境GEN_EMAIL兼容性错误 #199
Reference in New Issue
Block a user
Delete Branch "fix/cryptography-version"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
CI的Validate阶段,单元测试收集时4个文件报错:
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'(同类OpenSSL兼容性错误,含GEN_EMAIL)。根本原因:CI环境(Ubuntu 22.04)预装了系统级
python3-openssl(pyOpenSSL 21.0.0,位于/usr/lib/python3/dist-packages/),与pip安装的新版cryptography不兼容。当oss2 → aliyunsdkcore → import OpenSSL.SSL时,加载的是系统旧版pyOpenSSL,导致属性错误。受影响的测试:
修复方案
在
requirements-base.txt中显式锁定:cryptography==46.0.5— 与本地环境保持一致pyOpenSSL==26.2.0— 覆盖系统预装的旧版pyOpenSSL,确保与cryptography 46.0.5兼容两者均安装至
/usr/local/lib/python3.10/dist-packages/,优先级高于系统包。验证结果