Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 912794 Details for
Bug 976301
python-kerberos lakes a python3 variant
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
packaging patch
python3-support.patch (text/plain), 16.47 KB, created by
Michal Hlavinka
on 2014-06-27 12:14:02 UTC
(
hide
)
Description:
packaging patch
Filename:
MIME Type:
Creator:
Michal Hlavinka
Created:
2014-06-27 12:14:02 UTC
Size:
16.47 KB
patch
obsolete
>diff --git a/pykerberos-python3support-python26compatible.patch b/pykerberos-python3support-python26compatible.patch >new file mode 100644 >index 0000000..7aaca86 >--- /dev/null >+++ b/pykerberos-python3support-python26compatible.patch >@@ -0,0 +1,324 @@ >+diff -up python-kerberos-1.1/setup.py.python26compatible python-kerberos-1.1/setup.py >+--- python-kerberos-1.1/setup.py.python26compatible 2014-06-03 13:56:00.276897721 +0200 >++++ python-kerberos-1.1/setup.py 2014-06-03 13:56:30.205739546 +0200 >+@@ -18,17 +18,21 @@ >+ >+ from distutils.core import setup, Extension >+ import sys >+-import commands >++ >++if sys.version_info >= (3,0): >++ from subprocess import getoutput >++else: >++ from commands import getoutput >+ >+ setup ( >+ name = "kerberos", >+ version = "1.1", >+ description = "Kerberos high-level interface", >+ ext_modules = [ >+ Extension( >+ "kerberos", >+- extra_link_args = commands.getoutput("krb5-config --libs gssapi").split(), >+- extra_compile_args = commands.getoutput("krb5-config --cflags gssapi").split(), >++ extra_link_args = getoutput("krb5-config --libs gssapi").split(), >++ extra_compile_args = getoutput("krb5-config --cflags gssapi").split(), >+ sources = [ >+ "src/kerberos.c", >+ "src/kerberosbasic.c", >+diff -up python-kerberos-1.1/src/kerberos.c.python26compatible python-kerberos-1.1/src/kerberos.c >+--- python-kerberos-1.1/src/kerberos.c.python26compatible 2014-06-03 13:56:00.281897695 +0200 >++++ python-kerberos-1.1/src/kerberos.c 2014-06-03 13:56:00.285897674 +0200 >+@@ -22,6 +22,42 @@ >+ #include "kerberospw.h" >+ #include "kerberosgss.h" >+ >++/* >++ * Support the Python 3 API while maintaining backward compatibility for the >++ * Python 2 API. >++ * Thanks to Lennart Regebro for http://python3porting.com/cextensions.html >++ */ >++// Handle basic API changes >++#if PY_MAJOR_VERSION >= 3 >++ // Basic renames (function parameters are the same) >++ // No more int objects >++ #define PyInt_FromLong PyLong_FromLong >++ // CObjects to Capsules >++ #define PyCObject_Check PyCapsule_CheckExact >++ #define PyCObject_SetVoidPtr PyCapsule_SetPointer >++ >++ // More complex macros (function parameters are not the same) >++ // Note for PyCObject_FromVoidPtr, destr is now the third parameter >++ #define PyCObject_FromVoidPtr(cobj, destr) PyCapsule_New(cobj, NULL, destr) >++ #define PyCObject_AsVoidPtr(pobj) PyCapsule_GetPointer(pobj, NULL) >++#endif >++// Handle differences in module definition syntax and interface >++#if PY_MAJOR_VERSION >= 3 >++ #define MOD_ERROR_VAL NULL >++ #define MOD_SUCCESS_VAL(val) val >++ #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) >++ #define MOD_DEF(ob, name, doc, methods) \ >++ static struct PyModuleDef moduledef = { \ >++ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \ >++ ob = PyModule_Create(&moduledef); >++#else >++ #define MOD_ERROR_VAL >++ #define MOD_SUCCESS_VAL(val) >++ #define MOD_INIT(name) void init##name(void) >++ #define MOD_DEF(ob, name, doc, methods) \ >++ ob = Py_InitModule3(name, methods, doc); >++#endif >++ >+ PyObject *KrbException_class; >+ PyObject *BasicAuthException_class; >+ PyObject *PwdChangeException_class; >+@@ -424,11 +460,18 @@ static PyMethodDef KerberosMethods[] = { >+ {NULL, NULL, 0, NULL} /* Sentinel */ >+ }; >+ >+-PyMODINIT_FUNC initkerberos(void) >++/* >++ * Macros used to allow Python 2 and Python 3 compatibility. >++ * Thanks again to Lennart Regebro for http://python3porting.com/cextensions.html >++ */ >++MOD_INIT(kerberos) >+ { >+ PyObject *m,*d; >+ >+- m = Py_InitModule("kerberos", KerberosMethods); >++ MOD_DEF(m, "kerberos", NULL, KerberosMethods); >++ >++ if (m == NULL) >++ return MOD_ERROR_VAL; >+ >+ d = PyModule_GetDict(m); >+ >+@@ -467,6 +510,10 @@ PyMODINIT_FUNC initkerberos(void) >+ PyDict_SetItemString(d, "GSS_C_PROT_READY_FLAG", PyInt_FromLong(GSS_C_PROT_READY_FLAG)); >+ PyDict_SetItemString(d, "GSS_C_TRANS_FLAG", PyInt_FromLong(GSS_C_TRANS_FLAG)); >+ error: >+- if (PyErr_Occurred()) >++ if (PyErr_Occurred()) { >+ PyErr_SetString(PyExc_ImportError, "kerberos: init failed"); >++ return MOD_ERROR_VAL; >++ } >++ >++ return MOD_SUCCESS_VAL(m); >+ } >+diff -up python-kerberos-1.1/test.py.python26compatible python-kerberos-1.1/test.py >+--- python-kerberos-1.1/test.py.python26compatible 2008-09-17 12:35:22.000000000 +0200 >++++ python-kerberos-1.1/test.py 2014-06-03 13:56:00.285897674 +0200 >+@@ -18,7 +18,11 @@ >+ import kerberos >+ import getopt >+ import sys >+-import httplib >++if sys.version_info >= (3,0): >++ from http.client import HTTPSConnection, HTTPConnection >++else: >++ from httplib import HTTPSConnection, HTTPConnection >++ >+ >+ def main(): >+ >+@@ -48,40 +52,40 @@ def main(): >+ realm = value >+ >+ # Get service principal >+- print "\n*** Running Service Principal test" >++ print("\n*** Running Service Principal test") >+ s, h = service.split("@") >+ testServicePrincipal(s, h); >+ >+ # Run tests >+ if (len(user) != 0) and (len(pswd) != 0): >+- print "\n*** Running basic test" >++ print("\n*** Running basic test") >+ testCheckpassword(user, pswd, service, realm) >+ else: >+- print "\n*** Skipping basic test: no user or password specified" >++ print("\n*** Skipping basic test: no user or password specified") >+ >+- print "\n*** Running GSSAPI test" >++ print("\n*** Running GSSAPI test") >+ testGSSAPI(service) >+ >+- print "\n*** Running HTTP test" >++ print("\n*** Running HTTP test") >+ testHTTP(host, port, ssl, service) >+ >+- print "\n*** Done\n" >++ print("\n*** Done\n") >+ >+ def testServicePrincipal(service, hostname): >+ try: >+ result = kerberos.getServerPrincipalDetails(service, hostname) >+- except kerberos.KrbError, e: >+- print "Kerberos service principal for %s/%s failed: %s" % (service, hostname, e[0]) >++ except kerberos.KrbError as e: >++ print("Kerberos service principal for %s/%s failed: %s" % (service, hostname, e.args[0])) >+ else: >+- print "Kerberos service principal for %s/%s succeeded: %s" % (service, hostname, result) >++ print("Kerberos service principal for %s/%s succeeded: %s" % (service, hostname, result)) >+ >+ def testCheckpassword(user, pswd, service, realm): >+ try: >+ kerberos.checkPassword(user, pswd, service, realm) >+- except kerberos.BasicAuthError, e: >+- print "Kerberos authentication for %s failed: %s" % (user, e[0]) >++ except kerberos.BasicAuthError as e: >++ print("Kerberos authentication for %s failed: %s" % (user, e.args[0])) >+ else: >+- print "Kerberos authentication for %s succeeded" % user >++ print("Kerberos authentication for %s succeeded" % user) >+ >+ def testGSSAPI(service): >+ def statusText(r): >+@@ -93,46 +97,46 @@ def testGSSAPI(service): >+ return "Error" >+ >+ rc, vc = kerberos.authGSSClientInit(service); >+- print "Status for authGSSClientInit = %s" % statusText(rc); >++ print("Status for authGSSClientInit = %s" % statusText(rc)) >+ if rc != 1: >+ return >+ >+ rs, vs = kerberos.authGSSServerInit(service); >+- print "Status for authGSSServerInit = %s" % statusText(rs); >++ print("Status for authGSSServerInit = %s" % statusText(rs)) >+ if rs != 1: >+ return >+ >+ rc = kerberos.authGSSClientStep(vc, ""); >+- print "Status for authGSSClientStep = %s" % statusText(rc); >++ print("Status for authGSSClientStep = %s" % statusText(rc)) >+ if rc != 0: >+ return >+ >+ rs = kerberos.authGSSServerStep(vs, kerberos.authGSSClientResponse(vc)); >+- print "Status for authGSSServerStep = %s" % statusText(rs); >++ print("Status for authGSSServerStep = %s" % statusText(rs)) >+ if rs == -1: >+ return >+ >+ rc = kerberos.authGSSClientStep(vc, kerberos.authGSSServerResponse(vs)); >+- print "Status for authGSSClientStep = %s" % statusText(rc); >++ print("Status for authGSSClientStep = %s" % statusText(rc)) >+ if rc == -1: >+ return >+ >+- print "Server user name: %s" % kerberos.authGSSServerUserName(vs); >+- print "Client user name: %s" % kerberos.authGSSClientUserName(vc); >++ print("Server user name: %s" % kerberos.authGSSServerUserName(vs)) >++ print("Client user name: %s" % kerberos.authGSSClientUserName(vc)) >+ >+ rc = kerberos.authGSSClientClean(vc); >+- print "Status for authGSSClientClean = %s" % statusText(rc); >++ print("Status for authGSSClientClean = %s" % statusText(rc)) >+ >+ rs = kerberos.authGSSServerClean(vs); >+- print "Status for authGSSServerClean = %s" % statusText(rs); >++ print("Status for authGSSServerClean = %s" % statusText(rs)) >+ >+ def testHTTP(host, port, ssl, service): >+ def sendRequest(host, port, ssl, method, uri, headers): >+ response = None >+ if ssl: >+- http = httplib.HTTPSConnection(host, port) >++ http = HTTPSConnection(host, port) >+ else: >+- http = httplib.HTTPConnection(host, port) >++ http = HTTPConnection(host, port) >+ try: >+ http.request(method, uri, "", headers) >+ response = http.getresponse() >+@@ -146,16 +150,16 @@ def testHTTP(host, port, ssl, service): >+ response = sendRequest(host, port, ssl, "OPTIONS", uri, {}) >+ >+ if response is None: >+- print "Initial HTTP request to server failed" >++ print("Initial HTTP request to server failed") >+ return >+ >+ if response.status != 401: >+- print "Initial HTTP request did not result in a 404 response" >++ print("Initial HTTP request did not result in a 404 response") >+ return >+ >+ hdrs = response.msg.getheaders("www-authenticate") >+ if (hdrs is None) or (len(hdrs) == 0): >+- print "No www-authenticate header in initial HTTP response." >++ print("No www-authenticate header in initial HTTP response.") >+ for hdr in hdrs: >+ hdr = hdr.strip() >+ splits = hdr.split(' ', 1) >+@@ -164,19 +168,19 @@ def testHTTP(host, port, ssl, service): >+ else: >+ break >+ else: >+- print "No www-authenticate header with negotiate in initial HTTP response." >++ print("No www-authenticate header with negotiate in initial HTTP response.") >+ return >+ >+ try: >+ rc, vc = kerberos.authGSSClientInit(service); >+- except kerberos.GSSError, e: >+- print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[1][0]) >++ except kerberos.GSSError as e: >++ print("Could not initialize GSSAPI: %s/%s" % (e.args[0][0], e.args[1][0])) >+ return >+ >+ try: >+ kerberos.authGSSClientStep(vc, ""); >+- except kerberos.GSSError, e: >+- print "Could not do GSSAPI setp with continue: %s/%s" % (e[0][0], e[1][0]) >++ except kerberos.GSSError as e: >++ print("Could not do GSSAPI setp with continue: %s/%s" % (e.args[0][0], e.args[1][0])) >+ return >+ >+ hdrs = {} >+@@ -186,16 +190,16 @@ def testHTTP(host, port, ssl, service): >+ response = sendRequest(host, port, ssl, "OPTIONS", uri, hdrs) >+ >+ if response is None: >+- print "Second HTTP request to server failed" >++ print("Second HTTP request to server failed") >+ return >+ >+ if response.status/100 != 2: >+- print "Second HTTP request did not result in a 2xx response: %d" % (response.status,) >++ print("Second HTTP request did not result in a 2xx response: %d" % (response.status,)) >+ return >+ >+ hdrs = response.msg.getheaders("www-authenticate") >+ if (hdrs is None) or (len(hdrs) == 0): >+- print "No www-authenticate header in second HTTP response." >++ print("No www-authenticate header in second HTTP response.") >+ return >+ for hdr in hdrs: >+ hdr = hdr.strip() >+@@ -205,19 +209,19 @@ def testHTTP(host, port, ssl, service): >+ else: >+ break >+ else: >+- print "No www-authenticate header with negotiate in second HTTP response." >++ print("No www-authenticate header with negotiate in second HTTP response.") >+ return >+ >+ try: >+ kerberos.authGSSClientStep(vc, splits[1]) >+- except kerberos.GSSError, e: >+- print "Could not verify server www-authenticate header in second HTTP response: %s/%s" % (e[0][0], e[1][0]) >++ except kerberos.GSSError as e: >++ print("Could not verify server www-authenticate header in second HTTP response: %s/%s" % (e.args[0][0], e.args[1][0])) >+ return >+ >+ try: >+ rc = kerberos.authGSSClientClean(vc); >+- except kerberos.GSSError, e: >+- print "Could not clean-up GSSAPI: %s/%s" % (e[0][0], e[1][0]) >++ except kerberos.GSSError as e: >++ print("Could not clean-up GSSAPI: %s/%s" % (e.args[0][0], e.args[1][0])) >+ return >+ >+ return >diff --git a/python-kerberos.spec b/python-kerberos.spec >index f86aa79..5112a50 100644 >--- a/python-kerberos.spec >+++ b/python-kerberos.spec >@@ -1,8 +1,10 @@ >-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} >-%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} >+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} >+%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} >+%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} >+%{!?python3_sitearch: %global python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} > Name: python-kerberos > Version: 1.1 >-Release: 15%{?dist} >+Release: 16%{?dist} > Summary: A high-level wrapper for Kerberos (GSSAPI) operations > > Group: System Environment/Libraries >@@ -14,14 +16,17 @@ URL: http://trac.calendarserver.org/projects/calendarserver/browser/P > Source0: %{name}-%{version}.tar.gz > BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) > >-BuildRequires: python-devel >+BuildRequires: python2-devel, python3-devel > BuildRequires: krb5-devel >-BuildRequires: python-setuptools >+BuildRequires: python-setuptools, python3-setuptools >+ >+Provides: python2-kerberos > > Patch0: PyKerberos-delegation.patch > Patch1: PyKerberos-version.patch > Patch2: PyKerberos-inquire.patch > Patch3: PyKerberos-gsswrap.patch >+Patch4: pykerberos-python3support-python26compatible.patch > > %description > This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. >@@ -32,6 +37,15 @@ is needed for client/serverKerberos authentication based on > > Much of the C-code here is adapted from Apache's mod_auth_kerb-5.0rc7. > >+%package -n python3-kerberos >+Summary: A python 3 wrapper for Kerberos (GSSAPI) operations >+ >+%description -n python3-kerberos >+This Python 3 package is a high-level wrapper for Kerberos (GSSAPI) operations. >+The goal is to avoid having to build a module that wraps the entire >+Kerberos.framework, and instead offer a limited set of functions that do what >+is needed for client/serverKerberos authentication based on >+<http://www.ietf.org/rfc/rfc4559.txt>. > > %prep > %setup -q >@@ -40,13 +54,26 @@ Much of the C-code here is adapted from Apache's mod_auth_kerb-5.0rc7. > %patch1 -p1 -b .version > %patch2 -p1 -b .inquire > %patch3 -p1 -b .gsswrap >+%patch4 -p1 -b .python26compatible >+ >+# prep also python3 version >+rm -rf %{py3dir} >+cp -a . %{py3dir} > > %build >-%{__python} setup.py build >+%{__python2} setup.py build >+ >+pushd %{py3dir} >+%{__python3} setup.py build >+popd > > %install > rm -rf $RPM_BUILD_ROOT >-%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT >+%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT >+ >+pushd %{py3dir} >+%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT >+popd > > %clean > rm -rf $RPM_BUILD_ROOT >@@ -55,10 +82,16 @@ rm -rf $RPM_BUILD_ROOT > %files > %defattr(-,root,root,-) > %doc README.txt LICENSE test.py >-%{python_sitearch}/* >+%{python2_sitearch}/* > >+%files -n python3-kerberos >+%doc README.txt LICENSE test.py >+%{python3_sitearch}/* > > %changelog >+* Fri Jun 27 2014 Michal Hlavinka <mhlavink@redhat.com> - 1.1-16 >+- add support for python 3 (#976301) >+ > * Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-15 > - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 976301
:
863651
|
912794
|
1128262