Jac*_*din 2 python windows requirements.txt read-the-docs pythonnet
我在github上有一个小型应用程序项目,该项目可在Windows上运行,并且需要pythonnet
。
我的requirement.txt
包含:
beautifulsoup4==4.6
pythonnet==2.3
Run Code Online (Sandbox Code Playgroud)
现在我想为它建立一个文档并放上它readthedocs.org
。将文档推送到github,将项目导入之后readthedocs.org
,我尝试构建文档,但是此操作失败,并显示以下信息:
Collecting pythonnet==2.3 (from -r /home/docs/checkouts/readthedocs.org/user_builds/trelloradar/checkouts/latest/requirements.txt (line 2))
Using cached pythonnet-2.3.0.tar.gz
Building wheels for collected packages: pythonnet
Running setup.py bdist_wheel for pythonnet: started
Running setup.py bdist_wheel for pythonnet: finished with status 'error'
Complete output from command /home/docs/checkouts/readthedocs.org/user_builds/trelloradar/envs/latest/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-iU2ADR/pythonnet/setup.py'; f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpnPH_1rpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
/bin/sh: 1: mono: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-iU2ADR/pythonnet/setup.py", line 405, in <module>
zip_safe=False,
...
File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'mono tools/nuget/nuget.exe update -self' returned non-zero exit status 127
Run Code Online (Sandbox Code Playgroud)
我知道该构建失败是因为它试图pythonnet
在Unix环境上安装.Net资料,但是我只想用Sphinx来构建文档!
我禁用了venv选项:
使用setup.py install将项目安装在virtualenv中
但是我如何告诉readthedocs的构建过程忽略我的requirement.txt
?
我通过创建一个requirements.readthedocs.txt
空文件并在“管理”标签下的高级设置中将构建过程指向该文件来解决了这个问题。
另外,要autodoc
导入.Net模块而不抱怨,我将以下内容放入docs/conf.py
:
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()
MOCK_MODULES = ['clr', 'System', 'System.Windows.Forms', 'System.Threading']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
317 次 |
最近记录: |