mosra / m.css

A no-nonsense, no-JavaScript CSS framework, site and documentation theme for content-oriented websites
https://mcss.mosra.cz
Other
406 stars 92 forks source link

Python 3.12 Deprecation Warnings and Runtime script error #241

Closed AmeyaVS closed 2 weeks ago

AmeyaVS commented 6 months ago

I am having issue running mcss with a 3rd party tools which has a dependency on generating documentation using this tool.

Following Deprecation Warning and Error is captured:

/home/ameya/tools/mcss/documentation/doxygen.py:2364: DeprecationWarning: Testing an element's truth value will raise an exception in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.
  compound.has_details = compound.kind == 'group' or compound.brief or compounddef.find('detaileddescription') or (compound.kind == 'page' and not is_a_stupid_empty_markdown_page(compounddef))
/home/ameya/tools/mcss/documentation/doxygen.py:3420: DeprecationWarning: Testing an element's truth value will raise an exception in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.
  if entry.id not in state.compounds or not state.compounds[entry.id].has_details:
/home/ameya/tools/mcss/documentation/doxygen.py:2627: DeprecationWarning: Testing an element's truth value will raise an exception in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.
  if not compounddef.find('briefdescription') and not compounddef.find('detaileddescription') and not compounddef.attrib['kind'] == 'group' and (not compounddef.attrib['kind'] == 'page' or is_a_stupid_empty_markdown_page(compounddef)):
WARNING:root:classslang_1_1ast_1_1_compilation.xml: doxygen is unable to cross-link friend class Lookup, ignoring, sorry
WARNING:root:classslang_1_1ast_1_1_compilation.xml: doxygen is unable to cross-link friend class Scope, ignoring, sorry
Traceback (most recent call last):
  File "/home/ameya/tools/mcss/documentation/doxygen.py", line 4015, in <module>
    run(state, templates=os.path.abspath(args.templates), wildcard=args.wildcard, index_pages=args.index_pages, search_merge_subtrees=not args.search_no_subtree_merging, search_add_lookahead_barriers=not args.search_no_lookahead_barriers, search_merge_prefixes=not args.search_no_prefix_merging)
  File "/home/ameya/tools/mcss/documentation/doxygen.py", line 3872, in run
    parsed = parse_xml(state, file)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ameya/tools/mcss/documentation/doxygen.py", line 3034, in parse_xml
    member = parse_enum(state, memberdef)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ameya/tools/mcss/documentation/doxygen.py", line 1859, in parse_enum
    if enum.name.startswith('@'): enum.name = '(anonymous)'
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'startswith'

I am on a system with Python 3.12 installed.

mosra commented 6 months ago

Assuming you're on Doxygen 1.9 or newer, the error is probably related to #215 or #239. Unfortunately I don't have an estimate when I'll be able to get back to that (it's a nightmare, every new version breaks a ton of things that I have to work around), so for the time being a solution is using an older version of Doxygen. (Personally I'm on 1.8.16.)

The deprecation warnings OTOH are easy to fix I think. I'll look into those. Thanks!

mosra commented 2 weeks ago

This particular error is fixed with bcd5234567de5c9905932535125d49dfc1354da2 + c0194a3eb81057a3b029e66cf389a35f64375eef, the deprecation warnings then with 2588ef1a9a5420fa6b0dc39769ce582ce5dc5bd3, hopefully all of them.

Though note there's still a few remaining known issues with Doxygen 1.9+. Some of those require a fix in Doxygen itself, some of them I have to adapt to on my end. Tracking all that in #215.