Learn more about these different git repos.
Other Git URLs
Using the 'pagure' for GIT_AUTH_BACKEND on a Debian based system, one of Pagure's scripts tries to run as a Python 2 program, rather than with Python 3. The workaround is to to change this line:
GIT_AUTH_BACKEND
/usr/local/lib/python3.6/dist-packages/pagure-5.8.1-py3.6.egg/pagure/hooks/files/pre-receive -#!/usr/bin/env python +#!/usr/bin/env python3
This is because Debian based installations install both Python 2 and Python 3, and /usr/bin/python is Python 2 by default.
/usr/bin/python
There are other locations where this could pose a problem, in particular other neighboring hooks.
Would it be possible to adjust this code so it can run on both Fedora and Debian based OSes like Trisquel? Thanks! : )
2020-01-29 12:53:43,508 [ERROR] celery.app.trace: Task pagure.lib.tasks.create_project[ae0d0634-b120-4288-8aa4-8af3ca631720] raised unexpected: PagurePushDenied('Remote hook declined the push: Traceback (most recent call last):\nFile "hooks/pre-receive", line 31, in <module>\nimport pagure.lib\nImportError: No module named pagure.lib',) File "/usr/local/lib/python3.6/dist-packages/pagure-5.8.1-py3.6.egg/pagure/lib/git.py", line 1125, in _push File "/usr/lib/python3.6/subprocess.py", line 356, in check_output File "/usr/lib/python3.6/subprocess.py", line 438, in run subprocess.CalledProcessError: Command '['git', 'push', 'origin', '--follow-tags', 'refs/heads/master:refs/heads/master']' returned non-zero exit status 1. Traceback (most recent call last): R = retval = fun(*args, **kwargs) return self.run(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/pagure-5.8.1-py3.6.egg/pagure/lib/tasks_utils.py", line 36, in decorated_function return function(self, session, *args, **kwargs) tempclone.push("pagure", master_ref.name, internal="yes") self._push(username, pushref, force, **extra) File "/usr/local/lib/python3.6/dist-packages/pagure-5.8.1-py3.6.egg/pagure/lib/git.py", line 1140, in _push "Remote hook declined the push: %s" % "\n".join(remotes) pagure.exceptions.PagurePushDenied: Remote hook declined the push: Traceback (most recent call last): File "hooks/pre-receive", line 31, in <module> import pagure.lib ImportError: No module named pagure.lib
We set it to /usr/bin/env python to make it suitable for virtualenvs/development.
/usr/bin/env python
In fact, when I package Pagure, I change the shebangs in the packaging to point to Python 3.
You can see that here: https://src.fedoraproject.org/rpms/pagure/blob/d1207e2d509ac409a897df3e10e3316af7a67fe0/f/pagure.spec#_335
It should be relatively straightforward to adapt this for whatever deployment process you're using.
Thanks! If we go with Pagure, we'll probably just make a custom branch, and merge in upstream changes. We already do that with other software we run.
If we drop Python 2 support for Pagure 6.0, we'll probably permanently switch the shebangs to python3 variants. This is pretty much only a thing for supporting Python 2 or Python 3.
python3
I'm not sure what you would like us to do here. We support both py2 and py3 and we leave the choice of the version to the admins, at least until we drop py2 support.
How would you recommend we process this ticket?
I think that it's great that you support Python 2 and 3 for now. : ) I don't need any change to the code, because we can work around this with a custom Git branch. Feel free to close this issue when you drop Python 2 support, or at any time. Thanks : )
I've just addressed this issue in the pagure packaging of Debian (yes, that's still happening...).
Metadata Update from @ngompa: - Issue set to the milestone: 6.0
Login to comment on this ticket.