diff --git a/.gitignore b/.gitignore index e69de29..0029d19 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/python3-openid-3.0.2.tar.gz diff --git a/python3-openid-3.0.2-admin-runtests-python3.patch b/python3-openid-3.0.2-admin-runtests-python3.patch new file mode 100644 index 0000000..fae2567 --- /dev/null +++ b/python3-openid-3.0.2-admin-runtests-python3.patch @@ -0,0 +1,100 @@ +--- python3-openid-3.0.2/admin/runtests.orig 2013-10-22 20:42:35.000000000 +0200 ++++ python3-openid-3.0.2/admin/runtests 2013-11-29 10:24:07.524112906 +0100 +@@ -14,19 +14,19 @@ def fixpath(): + d = os.path.dirname(sys.argv[0]) + parent = os.path.normpath(os.path.join(d, '..')) + if parent not in sys.path: +- print "putting %s in sys.path" % (parent,) ++ print ("putting %s in sys.path" % (parent,)) + sys.path.insert(0, parent) + + def otherTests(): + failed = [] + for module_name in test_modules: +- print 'Testing %s...' % (module_name,) , ++ print ('Testing %s...' % (module_name,)) + sys.stdout.flush() + module_name = 'openid.test.' + module_name + try: + test_mod = __import__(module_name, {}, {}, [None]) + except ImportError: +- print 'Failed to import test %r' % (module_name,) ++ print ('Failed to import test %r' % (module_name,)) + failed.append(module_name) + else: + try: +@@ -37,7 +37,7 @@ def otherTests(): + sys.excepthook(*sys.exc_info()) + failed.append(module_name) + else: +- print 'Succeeded.' ++ print ('Succeeded.') + + + return failed +@@ -72,7 +72,7 @@ def pyunitTests(): + + try: + from openid.test import test_examples +- except ImportError, e: ++ except ImportError as e: + if 'twill' in str(e): + warnings.warn("Could not import twill; skipping test_examples.") + else: +@@ -110,10 +110,10 @@ def pyunitTests(): + m = __import__('openid.test.%s' % (name,), {}, {}, ['unused']) + try: + s.addTest(m.pyUnitTests()) +- except AttributeError, ex: ++ except AttributeError as ex: + # because the AttributeError doesn't actually say which + # object it was. +- print "Error loading tests from %s:" % (name,) ++ print ("Error loading tests from %s:" % (name,)) + raise + + runner = unittest.TextTestRunner() # verbosity=2) +@@ -125,7 +125,7 @@ def pyunitTests(): + def splitDir(d, count): + # in python2.4 and above, it's easier to spell this as + # d.rsplit(os.sep, count) +- for i in xrange(count): ++ for i in range(count): + d = os.path.dirname(d) + return d + +@@ -144,7 +144,9 @@ def _import_djopenid(): + djinit = os.path.join(djdir, '__init__.py') + + djopenid = types.ModuleType('djopenid') +- execfile(djinit, djopenid.__dict__) ++ with open(djinit) as f: ++ code = compile(f.read(), djinit, 'exec') ++ exec(code, djopenid.__dict__) + djopenid.__file__ = djinit + + # __path__ is the magic that makes child modules of the djopenid package +@@ -167,12 +169,12 @@ def django_tests(): + + try: + import django.test.simple +- except ImportError, e: ++ except ImportError as e: + warnings.warn("django.test.simple not found; " + "django examples not tested.") + return 0 + import djopenid.server.models, djopenid.consumer.models +- print "Testing Django examples:" ++ print ("Testing Django examples:") + + # These tests do get put in to a pyunit test suite, so we could run them + # with the other pyunit tests, but django also establishes a test database +@@ -193,7 +195,7 @@ def main(): + django_failures = django_tests() + + if other_failed: +- print 'Failures:', ', '.join(other_failed) ++ print ('Failures:', ', '.join(other_failed)) + + failed = (bool(other_failed) or + bool(not pyunit_result.wasSuccessful()) or diff --git a/python3-openid-3.0.2-cryptutil-bytes.patch b/python3-openid-3.0.2-cryptutil-bytes.patch new file mode 100644 index 0000000..7763beb --- /dev/null +++ b/python3-openid-3.0.2-cryptutil-bytes.patch @@ -0,0 +1,22 @@ +--- python3-openid-3.0.2/openid/cryptutil.py.orig 2013-11-29 09:53:00.730273249 +0100 ++++ python3-openid-3.0.2/openid/cryptutil.py 2013-11-29 09:53:24.816217916 +0100 +@@ -101,8 +101,8 @@ else: + raise ValueError('This function only supports positive integers') + + bytes = long_to_bytes(l) +- if ord(bytes[0]) > 127: +- return '\x00' + bytes ++ if bytes[0] > 127: ++ return b'\x00' + bytes + else: + return bytes + +@@ -110,7 +110,7 @@ else: + if not bytes: + raise ValueError('Empty string passed to strToLong') + +- if ord(bytes[0]) > 127: ++ if bytes[0] > 127: + raise ValueError('This function only supports positive integers') + + return bytes_to_long(bytes) diff --git a/python3-openid-3.0.2-parseXRDS.patch b/python3-openid-3.0.2-parseXRDS.patch new file mode 100644 index 0000000..491a119 --- /dev/null +++ b/python3-openid-3.0.2-parseXRDS.patch @@ -0,0 +1,11 @@ +--- python3-openid-3.0.2/openid/yadis/etxrd.py.orig 2014-01-10 10:00:49.974203343 +0100 ++++ python3-openid-3.0.2/openid/yadis/etxrd.py 2014-01-10 10:01:09.657206290 +0100 +@@ -66,6 +66,8 @@ def parseXRDS(text): + not contain an XRDS. + """ + try: ++ if isinstance(text, str): ++ text = text.encode('utf-8') + element = ElementTree.XML(text) + except XMLError as why: + exc = XRDSError('Error parsing document as XML') diff --git a/python3-openid.spec b/python3-openid.spec new file mode 100644 index 0000000..9b7967f --- /dev/null +++ b/python3-openid.spec @@ -0,0 +1,82 @@ +Name: python3-openid +Version: 3.0.2 +Release: 1%{?dist} +Summary: Python 3 port of the python-openid library +Group: Development/Libraries +License: ASL 2.0 +URL: https://github.com/necaris/python3-openid +Source0: http://github.srcurl.net/necaris/%{name}/v%{version}/%{name}-%{version}.tar.gz +Patch0: python3-openid-3.0.2-cryptutil-bytes.patch +Patch1: python3-openid-3.0.2-admin-runtests-python3.patch +Patch2: python3-openid-3.0.2-parseXRDS.patch + +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: python3-setuptools + +%description +This started out as a fork of the Python OpenID library, +with changes to make it Python 3 compatible. +It's now a port of that library, +including cleanups and updates to the code in general. + + +%prep +%setup -q +%patch0 -p1 -b .cryptutil-bytes +%patch1 -p1 -b .admin-runtests-python3 +%patch2 -p1 -b .parseXRDS + + +%build +%{__python3} setup.py build + + +%install +%{__python3} setup.py install --skip-build --root %{buildroot} + +# remove .po files +find %{buildroot} -name "*.po" | xargs rm -f + + +%check +LC_ALL=en_US.UTF-8 %{__python3} admin/runtests + + +%files +%doc CHANGES-* LICENSE NEWS.md NOTICE README.md +%dir %{python3_sitelib}/openid +%{python3_sitelib}/openid/*.py +%dir %{python3_sitelib}/openid/__pycache__ +%{python3_sitelib}/openid/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/consumer +%{python3_sitelib}/openid/consumer/*.py +%dir %{python3_sitelib}/openid/consumer/__pycache__ +%{python3_sitelib}/openid/consumer/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/extensions +%{python3_sitelib}/openid/extensions/*.py +%dir %{python3_sitelib}/openid/extensions/__pycache__ +%{python3_sitelib}/openid/extensions/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/extensions/draft +%{python3_sitelib}/openid/extensions/draft/*.py +%dir %{python3_sitelib}/openid/extensions/draft/__pycache__ +%{python3_sitelib}/openid/extensions/draft/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/server +%{python3_sitelib}/openid/server/*.py +%dir %{python3_sitelib}/openid/server/__pycache__ +%{python3_sitelib}/openid/server/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/store +%{python3_sitelib}/openid/store/*.py +%dir %{python3_sitelib}/openid/store/__pycache__ +%{python3_sitelib}/openid/store/__pycache__/*.py[co] +%dir %{python3_sitelib}/openid/yadis +%{python3_sitelib}/openid/yadis/*.py +%dir %{python3_sitelib}/openid/yadis/__pycache__ +%{python3_sitelib}/openid/yadis/__pycache__/*.py[co] +%{python3_sitelib}/python3_openid-%{version}-py3.*.egg-info + + +%changelog +* Fri Nov 29 2013 Jakub Dorňák - 3.0.2-1 +- Initial package diff --git a/sources b/sources index e69de29..7ca5778 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +5230967087791a001f25913b975aeb47 python3-openid-3.0.2.tar.gz