VACUMM / sphinx-fortran

Fortran domain and autodoc extensions to Sphinx
Other
45 stars 29 forks source link

TypeError in sort in "fortran_autodoc.py" #50

Closed Guymer closed 1 year ago

Guymer commented 1 year ago

When trying to build documentation, the following line raises an Exception:

tlist = sorted(self.get_blocklist('types', module))

... due to trying to sort incompatible types (dictionaries in this case). I have attached the full "Read The Docs" build log, including Traceback:

Guymer commented 1 year ago

I have managed to create a minimum-working-example which demonstrates this bug. It appears that the bug occurs when more than one TYPE is declared in a MODULE. working.zip works but broken.zip does not.

For working.zip:

username@hostname folder % unzip working.zip 
Archive:  working.zip
  inflating: working/docs/Makefile   
  inflating: working/docs/conf.py    
  inflating: working/docs/index.rst  
  inflating: working/docs/make.bat   
  inflating: working/src/mod_geo.F90  
username@hostname folder % gmake -r clean html -C working/docs 
gmake: Entering directory '/Users/username/Downloads/folder/working/docs'
Running Sphinx v6.2.1
making output directory... done
[autosummary] generating autosummary for: index.rst
parsing fortran sources...apoint <re.Match object; span=(0, 6), match='apoint'>
 done
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                      
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                                       
generating indices... genindex f-modindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
gmake: Leaving directory '/Users/username/Downloads/folder/working/docs'

For broken.zip:

username@hostname folder % unzip broken.zip 
Archive:  broken.zip
  inflating: broken/docs/Makefile    
  inflating: broken/docs/conf.py     
  inflating: broken/docs/index.rst   
  inflating: broken/docs/make.bat    
  inflating: broken/src/mod_geo.F90  
username@hostname folder % gmake -r clean html -C broken/docs 
gmake: Entering directory '/Users/username/Downloads/folder/broken/docs'
Running Sphinx v6.2.1
making output directory... done
[autosummary] generating autosummary for: index.rst
parsing fortran sources...apoint <re.Match object; span=(0, 6), match='apoint'>
aline <re.Match object; span=(0, 5), match='aline'>
 done
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                      
Exception occurred:
  File "/Users/username/Library/Python/3.11/lib/python/site-packages/sphinxfortran/fortran_autodoc.py", line 1246, in format_quickaccess
    tlist = sorted(self.get_blocklist('types', module))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'dict' and 'dict'
The full traceback has been saved in /tmp/sphinx-err-q_zdelgi.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
gmake: *** [Makefile:20: html] Error 2
gmake: Leaving directory '/Users/username/Downloads/folder/broken/docs'

I have uploaded that traceback too: sphinx-err-q_zdelgi.log. The diff of the two source files is:

username@hostname folder % diff working/src/mod_geo.F90 broken/src/mod_geo.F90 
11a12,19
> 
>     ! Declare type ...
>     TYPE aLine
>         LOGICAL(kind = INT8)                                                    :: ring
>         INTEGER(kind = INT32)                                                   :: npoints
>         REAL(kind = REAL64), ALLOCATABLE, DIMENSION(:)                          :: x    ! longitude
>         REAL(kind = REAL64), ALLOCATABLE, DIMENSION(:)                          :: y    ! latitude
>     END TYPE aLine

i.e., the broken one has one extra TYPE definition.

Guymer commented 1 year ago

I have found the bug (and it has already been fixed on GitHub but it has not been pushed out to PyPy).

... so ... when will the version of "sphinx-fortran" that is provided by the "pip install" command reflect that which is in this repository?

Thanks

Guymer commented 1 year ago

After yet more searching around I have realised that this issue is, in fact, a duplicate of #35 which has been fixed and merged, so I will close this issue. Still though, any schedule for updating the version in PyPy? Cheers