Related: https://pagure.io/koji/issue/3587
Backward-compatible - it is not nice that we have koji, koji_cli and kojihub modules. But leaving it this way doesn't need any change to plugins, etc which contain import kojihub.
import kojihub
(need double check with proper selinux installation, tested just in podman)
I've also left symlink to /usr/share/kojihub. Mainly for not changing httpd.conf with every python update.
httpd.conf
rebased onto ece7bc6e317d754f38d131b792088f8503ea8b6f
I always imagined we'd keep a stub loader in /usr/share/koji-hub. E.g. something like from kojihub.kojixmlrpc import application.
from kojihub.kojixmlrpc import application
+1 for not changing httpd.conf for every python version :smile:
If we rename hub/ → kojihub/ then PYTHONPATH=$CHECKOUT_DIR would make that import work as expected.
hub/
kojihub/
it is not nice that we have koji, koji_cli and kojihub modules
I kind of like having some separation indicating that these are not part of the core library, but yeah.
Could always adjust and leave compat wrappers
rebased onto cfa898a23dd8e5b4956be6dbe6621d7b83150fef
Addressed comments. One more slight incompatilibity in regard to plugins. As kojihub.__init__.py contains from .kojihub import *, private functions are not imported into that namespace. So, sidetag_hub.py is calling from kojihub.kojihub import. I'm not sure if it is good enough. On one hand I like separation of private methods to submodule, on the other hand some plugins can stop work.
kojihub.__init__.py
from .kojihub import *
sidetag_hub.py
from kojihub.kojihub import
We could always add some explicit imports of those private functions for backwards compatibility. We have internal plugins that rely on some of them as well. Granted, it's an easy enough change to make and plugins have a different expectation of compatibility across versions.
devtools/fakehub2 also needs the path fix
1 new commit added
import private functions
Added private functions to kojihub/__init__.py. Do you've some problems with fakehub? It works for me with current path.
kojihub/__init__.py
Do you've some problems with fakehub?
Oh, haha. Apparently fakehub2 is only in my checkout. The fakehub script works fine. Sorry for the confusion.
fakehub2
fakehub
ok, lgtm
Metadata Update from @tkopecek: - Pull-request tagged with: testing-ready
block py2 building for hub/web/util
4 new commits added
further changes
Move hub code to site-packages
@mikem One more question - placeholder /usr/share/koji-hub/kojiapp.py means updating httpd.conf. Not sure if it is better to use confusing kojixmlrpc.py placeholder name or to force admins to update their configurations.
/usr/share/koji-hub/kojiapp.py
kojixmlrpc.py
kojiapp is certainly a better name, but I'm not sure that kojixmlrpc is that confusing. We could always put a comment in the file explaining that the name is for backward compat.
kojiapp
kojixmlrpc
I guess if we wanted to get fancy, we could have both, but issue a deprecation warning when loading the old one. Not sure if it's worth the effort.
The other issue is namespace collision, in two ways. Currently, kojiapp.py and kojixmlrpc.py are in the same directory in the the checkout, so a simple rename would collide them. Also, I'm not entirely sure that we couldn't have a situation where plugin code had import kojixmlrpc and got the wrong one. Granted, I'm not sure any plugins do that.
import kojixmlrpc
Actually, regardless of the name, it seems wrong for kojiapp.py to be in the same dir of the checkout as the rest, since it is not part of the lib. It would probably be better to clearly separate the lib from the app here. Perhaps move kojiapp.py (or whatever we call it), httpd.conf, and hub.conf elsewhere? E.g. hub-app, kojihub/app?
rebased onto ddb9e3acb38aa31453901b0ae06e83ee24693c91
Moved to kojihub/app and leaving kojiapp.py without duplicate kojixmlrpc.py
kojihub/app
kojiapp.py
Metadata Update from @tkopecek: - Pull-request tagged with: scheduler
Metadata Update from @jcupova: - Pull-request tagged with: testing-done
rebased onto 95912eb31436ebd30e9a79d1f3f22b75be7c208a
Commit 463e469b fixes this pull-request
Pull-Request has been merged by tkopecek
Related: https://pagure.io/koji/issue/3587
Backward-compatible - it is not nice that we have koji, koji_cli and kojihub modules. But leaving it this way doesn't need any change to plugins, etc which contain
import kojihub.