Unbreak generation with dep diagrams with Python 3 (break Py2)
ClosedPublic

Authored by kossebau on May 16 2020, 2:18 PM.

Details

Summary

Works on the new zivo setup (api.kde.org) now having Python 3.

Python2 support not tested, but breaking any support on purpose,
as zivo was the last reason to still support it.

Diff Detail

Repository
R264 KApiDox
Branch
makedepworkwithpython3
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26994
Build 27012: arc lint + arc unit
kossebau created this revision.May 16 2020, 2:18 PM
Restricted Application added projects: Frameworks, Documentation. · View Herald TranscriptMay 16 2020, 2:18 PM
Restricted Application added subscribers: kde-doc-english, kde-frameworks-devel. · View Herald Transcript
kossebau requested review of this revision.May 16 2020, 2:18 PM
ognarb accepted this revision.May 16 2020, 2:32 PM

+1 and also +1 for removing python2 support

This revision is now accepted and ready to land.May 16 2020, 2:32 PM
cblack accepted this revision.May 16 2020, 3:01 PM

Thanks for the (first) review :)

Open questions I have are these:
a) how to properly check for the presence of the yaml.safe_load() method? and whether to support a fallback to load() otherwise? It was only introduced at a certain version of pyyaml
b) by supposedly breaking support for Python 2, how to properly catch any usage of python2 now?

Thanks for the (first) review :)

Open questions I have are these:
a) how to properly check for the presence of the yaml.safe_load() method? and whether to support a fallback to load() otherwise? It was only introduced at a certain version of pyyaml
b) by supposedly breaking support for Python 2, how to properly catch any usage of python2 now?

Best thing to do would be a follow-up patch that uses python3 shebangs. But frankly, I wouldn't care about Python 2. It's been EOL for half a year now and people have had more than enough time to migrate to Python 3.

Thanks for the (first) review :)

Open questions I have are these:
a) how to properly check for the presence of the yaml.safe_load() method? and whether to support a fallback to load() otherwise? It was only introduced at a certain version of pyyaml

Something like this should work

try:
    result = yaml.safe_load()
except AttributeError:
    result = yaml.load()

But I think you should require having a recent enough version of pyyaml for safe_load() to work. load() is not great in term of security :(

b) by supposedly breaking support for Python 2, how to properly catch any usage of python2 now?

Already answered by @cblack

I just applied the diff as-is to the working checkout of kapidox on the server, to see if the patch also works for the setup of the nightly run, other than my separate testing which might have missed any special environment setup. So tomorrow before noon CEST we should have proof this patch catches all issues.
So no immediate pressure to get this patch out ASAP to also get api.kde.org running again :)

Thanks for the additional replies, will look with attention tomorrow, afk this evening now.

Bah, I patched the wrong kapidox on the server, so last nights run still failed. Oh well... not sure I will have time in the evening for processing this patch, but at least now getting the diff applied also on the right kapidox, so next server check tomorrow.

Patch worked fine also on real server run the last two nights. So going to push later today once at my respective development setup. Will push as is, given safe_load() is now also used without any conditions for the new invent.kde.org git helper :) so doing as the real Python developers do.

kossebau retitled this revision from [RAW PATCH] Unbreak generation with dep diagrams with Python 3 (& break P2 :) ) to Unbreak generation with dep diagrams with Python 3 (break Py2).May 19 2020, 11:12 AM
kossebau edited the summary of this revision. (Show Details)
kossebau closed this revision.May 19 2020, 12:51 PM