Fix module imports with Python3
ClosedPublic

Authored by cordlandwehr on Nov 30 2019, 5:14 PM.

Details

Summary

The broken module import was covered by the missleading warning
"WARNING Missing Graphviz dependency: diagrams will not be generated."

Test Plan

Installed and run kapidox_generate ../kunitconversion/

Diff Detail

Repository
R264 KApiDox
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cordlandwehr created this revision.Nov 30 2019, 5:14 PM
Restricted Application added projects: Frameworks, Documentation. · View Herald TranscriptNov 30 2019, 5:14 PM
Restricted Application added subscribers: kde-doc-english, kde-frameworks-devel. · View Herald Transcript
cordlandwehr requested review of this revision.Nov 30 2019, 5:14 PM
ochurlaud accepted this revision.Dec 1 2019, 4:32 PM

If it still works it's OK to push.

This revision is now accepted and ready to land.Dec 1 2019, 4:32 PM
This revision was automatically updated to reflect the committed changes.
kossebau added a subscriber: kossebau.EditedJan 14 2020, 5:53 AM

Hi. Sadly api.kde.org failed to pick this change up until yesterday, as I had forgotten a change in the local checkout on my last work on the server, which then blocked the update via scripted git pull.
That I fixed partially yesterday, making sure latest KApiDox is run on api.kde.org, but that showed that gentoo(?) server running api.kde.org does not like yet this new code:

Traceback (most recent call last):
  File "/home/api/kapidox/src/kapidox_generate", line 110, in <module>
    main()
  File "/home/api/kapidox/src/kapidox_generate", line 106, in main
    copyright=kde_copyright)
  File "/home/api/kapidox/src/kapidox/hlfunctions.py", line 108, in do_it
    dot_files, tmp_dir)
  File "/home/api/kapidox/src/kapidox/generator.py", line 646, in generate_diagram
    with_qt=with_qt)
  File "/home/api/kapidox/src/kapidox/depdiagram/generate.py", line 156, in generate
    db.populate(dot_files, with_qt=with_qt)
  File "/home/api/kapidox/src/kapidox/depdiagram/frameworkdb.py", line 175, in populate
    fw = parser.parse(tier, dot_file)
  File "/home/api/kapidox/src/kapidox/depdiagram/frameworkdb.py", line 115, in parse
    dot_data =  preprocess(dot_file)
  File "/home/api/kapidox/src/kapidox/depdiagram/frameworkdb.py", line 75, in preprocess
    for node_handle in gvutils.get_node_list(graph_handle):
NameError: global name 'gvutils' is not defined

From https://api.kde.org/logs/api/frameworks/frameworks5.log

Seems that new import kapidox.depdiagram.gvutils is something the python there is not digesting as expected? (Edit: which is Python 2.7.15)

Not yet looked further myself, only got up now :)

No python developer myself, but from patterns seen I guess the imports should have some

if sys.version_info.major < 3:
    // python2 import style
else:
    // python3 import style

?

D26652 now up as proposal to fix this