Holzhaus / sphinx-multiversion

Sphinx extension for building self-hosted versioned docs.
https://holzhaus.github.io/sphinx-multiversion/
BSD 2-Clause "Simplified" License
148 stars 65 forks source link

object of type 'VersionInfo' has no len() #96

Open sagimann opened 1 year ago

sagimann commented 1 year ago

Hello, I'm new to sphinx multiversion. I tried to build using: sphinx-multiversion . public

and got:

Theme error:
An error happened in rendering the page docs/common_structures/MyStruct.
Reason: TypeError("object of type 'VersionInfo' has no len()")
Traceback (most recent call last):
  File "C:\Users\MyUser\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\MyUser\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\MyUser\my\my-doc\venv\Scripts\sphinx-multiversion.exe\__main__.py", line 7, in <module>
  File "C:\Users\MyUser\my\my-doc\venv\lib\site-packages\sphinx_multiversion\main.py", line 338, in main
    subprocess.check_call(cmd, cwd=current_cwd)
  File "C:\Users\MyUser\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('C:\\Users\\MyUser\\my\\my-doc\\venv\\Scripts\\python.exe', '-R', '-m', 'sphinx', '-D', 'smv_metadata_path=C:\\Users\\MyUser\\AppData\\Local\\Temp\\tmpn116xt2f\\versions.json', '-D', 'smv_current_version=586-branch1', '-c', 'C:\\Users\\MyUser\\my\\my-doc', 'C:\\Users\\MyUser\\AppData\\Local\\Temp\\tmpn116xt2f\\05292799e6726d55a753048c097d5351cdc459ef\\.', 'C:\\Users\\MyUser\\my\\my-doc\\public\\586-branch1')' returned non-zero exit status 2.

I am using python3 venv and installed latest sphinx multiversion using pip. My conf.py has the following:

extensions = [
    'sphinx_rtd_theme',
...
    'sphinx_multiversion'
]

templates_path = ['_templates']

# SET CURRENT_VERSION
from git import Repo
repo = Repo( search_parent_directories=True )
current_version = repo.active_branch.name
html_context['current_version'] = current_version
html_context['version'] = current_version
html_context['versions'] = list()
versions = [branch.name for branch in repo.branches]
for version in versions:
    html_context['versions'].append( (version, f'/{VERSION_BASE_URI}/{version}/index.html') )