Accepting request 199247 from home:scarabeus_iv
- Fix the symlink creation. - Drop r7486-python33-compat.patch as it is not needed. - Use update-alternatives to allow switching between py2 and py3 version of doctool binaries. OBS-URL: https://build.opensuse.org/request/show/199247 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-docutils?expand=0&rev=22
This commit is contained in:
parent
558bcb3109
commit
898dc78255
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 16 12:09:22 UTC 2013 - tchvatal@suse.com
|
||||
|
||||
- Fix the symlink creation.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 16 10:32:48 UTC 2013 - tchvatal@suse.com
|
||||
|
||||
- Drop r7486-python33-compat.patch as it is not needed.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 16 10:31:09 UTC 2013 - tchvatal@suse.com
|
||||
|
||||
- Use update-alternatives to allow switching between py2 and py3
|
||||
version of doctool binaries.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 3 15:37:57 UTC 2013 - dmueller@suse.com
|
||||
|
||||
|
@ -37,6 +37,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%else
|
||||
BuildArch: noarch
|
||||
%endif
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
|
||||
%description
|
||||
Docutils is a modular system for processing documentation into useful formats,
|
||||
@ -47,22 +49,64 @@ easy-to-read, what-you-see-is-what-you-get plaintext markup syntax.
|
||||
%setup -n docutils-%{version}
|
||||
%patch0
|
||||
# Remove useless ".py" ending from executables:
|
||||
for i in tools/rst*; do mv "$i" "${i/.py}"; done
|
||||
sed -i "s|'tools/\(rst.*\)\.py'|'tools/\1'|" setup.py
|
||||
for i in tools/rst*; do mv "$i" "${i/.py}-%{py_ver}"; done
|
||||
sed -i "s|'tools/\(rst.*\)\.py'|'tools/\1-%{py_ver}'|" setup.py
|
||||
|
||||
%build
|
||||
python setup.py build
|
||||
|
||||
%install
|
||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||
binaries="rst2html rst2latex rst2man rst2odt rst2odt_prepstyles rst2pseudoxml rst2s5 rst2xetex rst2xml rstpep2html"
|
||||
for i in $binaries; do
|
||||
ln -s %{_bindir}/${i}-%{py_ver} %{buildroot}%{_bindir}/${i}
|
||||
done
|
||||
|
||||
%check
|
||||
nosetests
|
||||
|
||||
%pre
|
||||
# Since binaries became ghosted to be used with update-alternatives,
|
||||
# we have to get rid of the old binary resulting from the
|
||||
# non-update-alternativies-ified package.
|
||||
binaries="rst2html rst2latex rst2man rst2odt rst2odt_prepstyles rst2pseudoxml rst2s5 rst2xetex rst2xml rstpep2html"
|
||||
for i in $binaries; do
|
||||
[[ ! -L %{_bindir}/${i} ]] && rm -f %{_bindir}/${i}
|
||||
done
|
||||
exit 0
|
||||
|
||||
%post
|
||||
update-alternatives \
|
||||
--install %{_bindir}/rst2html rst2html %{_bindir}/rst2html-%{py_ver} 20 \
|
||||
--slave %{_bindir}/rst2latex rst2latex %{_bindir}/rst2latex-%{py_ver} \
|
||||
--slave %{_bindir}/rst2man rst2man %{_bindir}/rst2man-%{py_ver} \
|
||||
--slave %{_bindir}/rst2odt rst2odt %{_bindir}/rst2odt-%{py_ver} \
|
||||
--slave %{_bindir}/rst2odt_prepstyles rst2odt_prepstyles %{_bindir}/rst2odt_prepstyles-%{py_ver} \
|
||||
--slave %{_bindir}/rst2pseudoxml rst2pseudoxml %{_bindir}/rst2pseudoxml-%{py_ver} \
|
||||
--slave %{_bindir}/rst2s5 rst2s5 %{_bindir}/rst2s5-%{py_ver} \
|
||||
--slave %{_bindir}/rst2xetex rst2xetex %{_bindir}/rst2xetex-%{py_ver} \
|
||||
--slave %{_bindir}/rst2xml rst2xml %{_bindir}/rst2xml-%{py_ver} \
|
||||
--slave %{_bindir}/rstpep2html rstpep2html %{_bindir}/rstpep2html-%{py_ver}
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
update-alternatives --remove rst2html %{_bindir}/rst2html-%{py_ver}
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc COPYING.txt FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/* licenses
|
||||
%{_bindir}/rst*
|
||||
%ghost %{_bindir}/rst2html
|
||||
%ghost %{_bindir}/rst2latex
|
||||
%ghost %{_bindir}/rst2man
|
||||
%ghost %{_bindir}/rst2odt
|
||||
%ghost %{_bindir}/rst2odt_prepstyles
|
||||
%ghost %{_bindir}/rst2pseudoxml
|
||||
%ghost %{_bindir}/rst2s5
|
||||
%ghost %{_bindir}/rst2xetex
|
||||
%ghost %{_bindir}/rst2xml
|
||||
%ghost %{_bindir}/rstpep2html
|
||||
%{_bindir}/rst*-%{py_ver}
|
||||
%{python_sitelib}/docutils/
|
||||
%{python_sitelib}/docutils-%{version}-py%{py_ver}.egg-info
|
||||
|
||||
|
@ -1,179 +0,0 @@
|
||||
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