我怎样才能让 readthedocs.org 构建忽略我的 requirement.txt?
How can I get readthedocs.org build to ignore my requirement.txt?
我在 github 上有一个小型应用程序项目,它在 Windows 上运行并且需要 pythonnet
。
我的 requirement.txt
包含:
beautifulsoup4==4.6
pythonnet==2.3
现在我想为它建立一个文档并将其放在 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
我知道构建失败是因为它试图在 Unix 环境中安装 .Net material,即 pythonnet
,但我只想用 Sphinx 构建文档!
我已经禁用了 venv 选项:
Install your project inside a virtualenv using setup.py install
但是我如何告诉 readthedocs 的构建过程忽略我的 requirement.txt
?
我通过创建一个 requirements.readthedocs.txt
空文件并在 Admin 选项卡下的高级设置中将构建过程指向它来解决这个问题。
此外,为了让 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)
我在 github 上有一个小型应用程序项目,它在 Windows 上运行并且需要 pythonnet
。
我的 requirement.txt
包含:
beautifulsoup4==4.6
pythonnet==2.3
现在我想为它建立一个文档并将其放在 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
我知道构建失败是因为它试图在 Unix 环境中安装 .Net material,即 pythonnet
,但我只想用 Sphinx 构建文档!
我已经禁用了 venv 选项:
Install your project inside a virtualenv using setup.py install
但是我如何告诉 readthedocs 的构建过程忽略我的 requirement.txt
?
我通过创建一个 requirements.readthedocs.txt
空文件并在 Admin 选项卡下的高级设置中将构建过程指向它来解决这个问题。
此外,为了让 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)