How can I get readthedocs.org build to ignore my requirement.txt?
Asked Answered
B

1

5

I have a small app project on github which runs on Windows and requires pythonnet.

My requirement.txt contains:

beautifulsoup4==4.6
pythonnet==2.3

Now I thought I would build a documentation for it and put it on readthedocs.org. After pushing my documentation to github, importing my project on readthedocs.org, I tried to build the documentation but this operation failed with:

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 

I understand that the build fails because it is trying to install .Net material, namely pythonnet, on a Unix environment, but I just want to build the docs with Sphinx!

I have disabled the venv option:

Install your project inside a virtualenv using setup.py install

But how do I tell readthedocs' build process to ignore my requirement.txt?

Blackfellow answered 12/1, 2018 at 10:49 Comment(0)
B
8

I solved this by creating a requirements.readthedocs.txt empty file and point the build process to it in the advanced settings under the Admin tab.

Also, to get autodoc to import the .Net modules without complaining I put the following in 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)
Blackfellow answered 12/1, 2018 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.