Accepting request 139690 from devel:languages:python
patch for python 3.3 (Factory) added this resolves build failure for python3-Sphinx (forwarded request 139388 from HighwayStar) OBS-URL: https://build.opensuse.org/request/show/139690 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-docutils?expand=0&rev=7
This commit is contained in:
commit
086267c6f5
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 26 08:26:29 UTC 2012 - highwaystar.ru@gmail.com
|
||||
|
||||
- patch from upstream for python3.3 support
|
||||
* Fix [3541369] Relative __import__ also with Python 3.3
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 3 14:28:17 UTC 2012 - toddrme2178@gmail.com
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%define modname docutils
|
||||
Name: python-%{modname}
|
||||
Version: 0.9
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 26 08:25:52 UTC 2012 - highwaystar.ru@gmail.com
|
||||
|
||||
- patch from upstream for python3.3 support
|
||||
* Fix [3541369] Relative __import__ also with Python 3.3
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 3 14:28:17 UTC 2012 - toddrme2178@gmail.com
|
||||
|
||||
|
@ -11,10 +11,11 @@
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
#
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%define modname docutils
|
||||
Name: python3-%{modname}
|
||||
Version: 0.9
|
||||
@ -24,6 +25,8 @@ License: Python-2.0 and BSD-2-Clause and GPL-2.0+ and GPL-3.0+ and SUSE-P
|
||||
Group: Development/Languages/Python
|
||||
Url: http://docutils.sourceforge.net/
|
||||
Source: http://downloads.sourceforge.net/project/%{modname}/%{modname}/%{version}/%{modname}-%{version}.tar.gz
|
||||
# patch from upstream: r7486 Fix [3541369] Relative __import__ also with Python 3.3
|
||||
Patch0: r7486-python33-compat.patch
|
||||
BuildRequires: python3
|
||||
BuildRequires: python3-2to3
|
||||
BuildRequires: python3-devel
|
||||
@ -44,7 +47,7 @@ easy-to-read, what-you-see-is-what-you-get plaintext markup syntax.
|
||||
|
||||
%prep
|
||||
%setup -n %{modname}-%{version}
|
||||
|
||||
%patch0 -p2
|
||||
%build
|
||||
python3 setup.py build
|
||||
sed -i "s|#!\s*\/usr\/bin\/env python3||g" docutils/{math/math2html,_string_template_compat,error_reporting,writers/xetex/__init__,math/latex2mathml}.py # Fix non-executable scripts
|
||||
|
179
r7486-python33-compat.patch
Normal file
179
r7486-python33-compat.patch
Normal file
@ -0,0 +1,179 @@
|
||||
Index: trunk/docutils/docutils/parsers/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/parsers/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/parsers/__init__.py (revision 7486)
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
__docformat__ = 'reStructuredText'
|
||||
|
||||
+import sys
|
||||
from docutils import Component
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
|
||||
class Parser(Component):
|
||||
@@ -43,5 +46,5 @@
|
||||
parser_name = parser_name.lower()
|
||||
if parser_name in _parser_aliases:
|
||||
parser_name = _parser_aliases[parser_name]
|
||||
- module = __import__(parser_name, globals(), locals())
|
||||
+ module = __import__(parser_name, globals(), locals(), level=1)
|
||||
return module.Parser
|
||||
Index: trunk/docutils/docutils/parsers/rst/directives/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/parsers/rst/directives/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/parsers/rst/directives/__init__.py (revision 7486)
|
||||
@@ -10,8 +10,12 @@
|
||||
|
||||
import re
|
||||
import codecs
|
||||
+import sys
|
||||
+
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst.languages import en as _fallback_language_module
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
|
||||
_directive_registry = {
|
||||
@@ -109,7 +113,7 @@
|
||||
# Error handling done by caller.
|
||||
return None, messages
|
||||
try:
|
||||
- module = __import__(modulename, globals(), locals())
|
||||
+ module = __import__(modulename, globals(), locals(), level=1)
|
||||
except ImportError, detail:
|
||||
messages.append(document.reporter.error(
|
||||
'Error importing directive module "%s" (directive "%s"):\n%s'
|
||||
Index: trunk/docutils/docutils/parsers/rst/languages/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/parsers/rst/languages/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/parsers/rst/languages/__init__.py (revision 7486)
|
||||
@@ -12,7 +12,11 @@
|
||||
|
||||
__docformat__ = 'reStructuredText'
|
||||
|
||||
+import sys
|
||||
+
|
||||
from docutils.utils import normalize_language_tag
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
_languages = {}
|
||||
|
||||
@@ -21,7 +25,7 @@
|
||||
if tag in _languages:
|
||||
return _languages[tag]
|
||||
try:
|
||||
- module = __import__(tag, globals(), locals())
|
||||
+ module = __import__(tag, globals(), locals(), level=1)
|
||||
except ImportError:
|
||||
continue
|
||||
_languages[tag] = module
|
||||
Index: trunk/docutils/docutils/writers/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/writers/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/writers/__init__.py (revision 7486)
|
||||
@@ -8,11 +8,14 @@
|
||||
|
||||
__docformat__ = 'reStructuredText'
|
||||
|
||||
+import os.path
|
||||
+import sys
|
||||
|
||||
-import os.path
|
||||
import docutils
|
||||
from docutils import languages, Component
|
||||
from docutils.transforms import universal
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
|
||||
class Writer(Component):
|
||||
@@ -130,5 +133,5 @@
|
||||
writer_name = writer_name.lower()
|
||||
if writer_name in _writer_aliases:
|
||||
writer_name = _writer_aliases[writer_name]
|
||||
- module = __import__(writer_name, globals(), locals())
|
||||
+ module = __import__(writer_name, globals(), locals(), level=1)
|
||||
return module.Writer
|
||||
Index: trunk/docutils/docutils/readers/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/readers/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/readers/__init__.py (revision 7486)
|
||||
@@ -8,9 +8,12 @@
|
||||
|
||||
__docformat__ = 'reStructuredText'
|
||||
|
||||
+import sys
|
||||
|
||||
from docutils import utils, parsers, Component
|
||||
from docutils.transforms import universal
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
|
||||
class Reader(Component):
|
||||
@@ -103,5 +106,5 @@
|
||||
reader_name = reader_name.lower()
|
||||
if reader_name in _reader_aliases:
|
||||
reader_name = _reader_aliases[reader_name]
|
||||
- module = __import__(reader_name, globals(), locals())
|
||||
+ module = __import__(reader_name, globals(), locals(), level=1)
|
||||
return module.Reader
|
||||
Index: trunk/docutils/docutils/languages/__init__.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/languages/__init__.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/languages/__init__.py (revision 7486)
|
||||
@@ -11,7 +11,11 @@
|
||||
|
||||
__docformat__ = 'reStructuredText'
|
||||
|
||||
+import sys
|
||||
+
|
||||
from docutils.utils import normalize_language_tag
|
||||
+if sys.version_info < (2,5):
|
||||
+ from docutils._compat import __import__
|
||||
|
||||
_languages = {}
|
||||
|
||||
@@ -26,7 +30,7 @@
|
||||
if tag in _languages:
|
||||
return _languages[tag]
|
||||
try:
|
||||
- module = __import__(tag, globals(), locals())
|
||||
+ module = __import__(tag, globals(), locals(), level=1)
|
||||
except ImportError:
|
||||
continue
|
||||
_languages[tag] = module
|
||||
@@ -35,6 +39,6 @@
|
||||
reporter.warning(
|
||||
'language "%s" not supported: ' % language_code +
|
||||
'Docutils-generated text will be in English.')
|
||||
- module = __import__('en', globals(), locals())
|
||||
+ module = __import__('en', globals(), locals(), level=1)
|
||||
_languages[tag] = module # warn only one time!
|
||||
return module
|
||||
Index: trunk/docutils/docutils/_compat.py
|
||||
===================================================================
|
||||
--- trunk/docutils/docutils/_compat.py (revision 7485)
|
||||
+++ trunk/docutils/docutils/_compat.py (revision 7486)
|
||||
@@ -35,3 +35,14 @@
|
||||
# using this hack since 2to3 "fixes" the relative import
|
||||
# when using ``from io import BytesIO``
|
||||
BytesIO = __import__('io').BytesIO
|
||||
+
|
||||
+if sys.version_info < (2,5):
|
||||
+ import __builtin__
|
||||
+
|
||||
+ def __import__(name, globals={}, locals={}, fromlist=[], level=-1):
|
||||
+ """Compatibility definition for Python 2.4.
|
||||
+
|
||||
+ Silently ignore the `level` argument missing in Python < 2.5.
|
||||
+ """
|
||||
+ # we need the level arg because the default changed in Python 3.3
|
||||
+ return __builtin__.__import__(name, globals, locals, fromlist)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user