m.css icon indicating copy to clipboard operation
m.css copied to clipboard

Python 3.12 Deprecation Warnings and Runtime script error

Open AmeyaVS opened this issue 1 year ago • 1 comments

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.

AmeyaVS avatar Mar 27 '24 03:03 AmeyaVS

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 avatar Mar 27 '24 10:03 mosra

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.

mosra avatar Sep 11 '24 23:09 mosra