0

I've got a couple of projects here for which I'm preparing documentation at the moment, hosted at readthedocs.org. FYI, all of them use poetry and I use custom .readthedocs.yml files with this entry:

python:
  install:
    - method: pip
      path: .

It works fine for most projects, but it fails for two for different reasons during installation of the project via pip:

  1. The first one uses PyGObject, which failes like this:
Package gobject-introspection-1.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gobject-introspection-1.0' found
  Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.56.0')' returned non-zero exit status 1.
  
  Try installing it with: 'sudo apt install libgirepository1.0-dev'

So it seems that PyGObject cannot be installed without some system packages to be installed. I could rearrange the code so that the import is not top-level. But still I need it in the dependencies. Can I tell pip install to ignore this single package somehow? Any other idea?

  1. The second project compiles some C++ code via Cython and fails, because it's missing a library. I use a custom build script in the pyproject.toml:
[tool.poetry.build]
script = "build.py"
generate-setup-file = false

Is there some flag in pip that I could set and retrieve in build.py to skip the compilation? Or is there a better way?

The_Fallen
  • 257
  • 1
  • 3
  • 10
  • 1
    You can [install system packages with `apt`](https://docs.readthedocs.io/en/latest/config-file/v2.html#build-apt-packages). If not [check](https://docs.readthedocs.io/en/latest/faq.html#how-do-i-change-behavior-when-building-with-read-the-docs) for environment variable 'READTHEDOCS'. – phd Jan 18 '22 at 15:39
  • Ha, perfect! That's what I was looking for, thanks! – The_Fallen Jan 18 '22 at 16:01
  • Just to let you know, just implemented both and it works like a charm. Thanks again. – The_Fallen Jan 18 '22 at 16:40

0 Answers0