我正在尝试编写脚本,它应该使用 Portage API。但是 Portage python 包在 PyPi 中不可用,但即使它可用也没有任何意义,因为它应该从一些带有包数据库和配置的配置系统中使用。
我试图编写以下丑陋的代码:
[tool.poetry.dependencies]
python = "^3.6"
click = "^7.0-r1"
portage = [
{ markers = "python_version ~= '3.6' and sys_platform == 'linux'", path = "/usr/lib64/python3.6/site-packages/portage/" },
{ markers = "python_version ~= '3.7' and sys_platform == 'linux'", path = "/usr/lib64/python3.7/site-packages/portage/" },
{ markers = "python_version ~= '3.8' and sys_platform == 'linux'", path = "/usr/lib64/python3.8/site-packages/portage/" },
{ markers = "python_version ~= '3.9' and sys_platform == 'linux'", path = "/usr/lib64/python3.9/site-packages/portage/" }
]
但它不起作用。Poetry 不将路径目录中的代码视为 python 包。
[ValueError]
Directory /usr/lib64/python3.6/site-packages/portage does not seem to be a Python package
有没有办法做到这一点并将系统用作运行测试的虚拟环境(我知道在主机系统中运行测试不是一个好主意,但是有一个安装了 Portage 的 docker 映像)?