[Python-apps-commits] r11009 - in packages/s3ql/trunk/debian (5 files)

nikratio-guest at users.alioth.debian.org nikratio-guest at users.alioth.debian.org
Sun Jun 29 22:05:57 UTC 2014


    Date: Sunday, June 29, 2014 @ 22:05:56
  Author: nikratio-guest
Revision: 11009

Added patches/sphinx_build_locale_fix.diff (cherry-picked from upstream)
to make documentation build work independent of system locale.

Added:
  packages/s3ql/trunk/debian/patches/sphinx_build_locale_fix.diff
    (from rev 11005, packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff)
Modified:
  packages/s3ql/trunk/debian/changelog
  packages/s3ql/trunk/debian/control
  packages/s3ql/trunk/debian/patches/series
Deleted:
  packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff

Modified: packages/s3ql/trunk/debian/changelog
===================================================================
--- packages/s3ql/trunk/debian/changelog	2014-06-29 19:54:43 UTC (rev 11008)
+++ packages/s3ql/trunk/debian/changelog	2014-06-29 22:05:56 UTC (rev 11009)
@@ -3,7 +3,8 @@
   * New upstream release.
   * Dropped patches/sphinx-1.1.1-compat.diff (no longer required now
     that Sphinx 1.2 is in unstable).
-  * Added patches/workaround_sphinx_bug_1196.diff.
+  * Added patches/sphinx_build_locale_fix.diff (cherry-picked from upstream)
+    to make documentation build work independent of system locale.
 
  -- Nikolaus Rath <Nikolaus at rath.org>  Sat, 28 Jun 2014 12:30:45 -0700
 

Modified: packages/s3ql/trunk/debian/control
===================================================================
--- packages/s3ql/trunk/debian/control	2014-06-29 19:54:43 UTC (rev 11008)
+++ packages/s3ql/trunk/debian/control	2014-06-29 22:05:56 UTC (rev 11009)
@@ -15,9 +15,9 @@
                python3-llfuse (>= 0.39),
                python3-crypto,
                python3-requests,
-               python3-dugong (>= 3.1),
+               python3-dugong (>= 3.0),
                python3-pytest (>= 2.3.3),
-               python3-defusedxml,
+#               python3-defusedxml,
                cython3 (>= 0.17),
                texlive-latex-base,
                texlive-latex-recommended,

Modified: packages/s3ql/trunk/debian/patches/series
===================================================================
--- packages/s3ql/trunk/debian/patches/series	2014-06-29 19:54:43 UTC (rev 11008)
+++ packages/s3ql/trunk/debian/patches/series	2014-06-29 22:05:56 UTC (rev 11009)
@@ -1,3 +1,3 @@
 proc_mount.diff
 clock-granularity.diff
-workaround_sphinx_bug_1196.diff
+sphinx_build_locale_fix.diff

Copied: packages/s3ql/trunk/debian/patches/sphinx_build_locale_fix.diff (from rev 11005, packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff)
===================================================================
--- packages/s3ql/trunk/debian/patches/sphinx_build_locale_fix.diff	                        (rev 0)
+++ packages/s3ql/trunk/debian/patches/sphinx_build_locale_fix.diff	2014-06-29 22:05:56 UTC (rev 11009)
@@ -0,0 +1,119 @@
+Description: Make documentation building locale-independent
+Origin: https://bitbucket.org/nikratio/s3ql/commits/4c3050faf0bcc7613545288ab940805ad9608b65
+Forwarded: not-needed
+Last-Update: <2014-06-29>
+Author: Nikolaus Rath <Nikolaus at rath.org>
+
+This patch has been cherry picked from upstream, and makes sure
+that the documentation can be build even if the system has unusal
+locale setting.
+
+--- a/util/sphinx_pipeinclude.py
++++ b/util/sphinx_pipeinclude.py
+@@ -13,7 +13,8 @@
+ from docutils.parsers.rst.directives.misc import Include
+ import subprocess
+ import shlex
+-from docutils import io, nodes, statemachine
++from docutils.utils.error_reporting import SafeString
++import tempfile
+ import os.path
+ import sys
+ 
+@@ -23,6 +24,10 @@
+     """
+ 
+     def run(self):
++        # To maximize code reuse, we just write the output in a temporary
++        # file and call the base class. Otherwise we'd have to copy & paste
++        # all the code to handle start-line, end-line etc options.
++
+         source = self.state_machine.input_lines.source(
+             self.lineno - self.state_machine.input_offset - 1)
+         source_dir = os.path.dirname(os.path.abspath(source))
+@@ -33,74 +38,17 @@
+         if command_list[0] == 'python':
+             command_list[0] = sys.executable
+ 
+-        encoding = self.options.get(
+-            'encoding', self.state.document.settings.input_encoding)
+-        tab_width = self.options.get(
+-            'tab-width', self.state.document.settings.tab_width)
+-
+-        try:
+-            child = subprocess.Popen(command_list, stdout=subprocess.PIPE,
+-                                     cwd=source_dir, universal_newlines=True)
+-            include_file = io.FileInput(
+-                source=child.stdout, encoding=encoding,
+-                error_handler=(self.state.document.settings.\
+-                               input_encoding_error_handler),
+-                handle_io_errors=None)
+-        except IOError as error:
+-            raise self.severe('Problems with "%s" directive path:\n%s: %s.' %
+-                        (self.name, error.__class__.__name__, str(error)))
+-            # Hack: Since Python 2.6, the string interpolation returns a
+-            # unicode object if one of the supplied %s replacements is a
+-            # unicode object. IOError has no `__unicode__` method and the
+-            # fallback `__repr__` does not report the file name. Explicitely
+-            # converting to str fixes this for now::
+-            #   print '%s\n%s\n%s\n' %(error, str(error), repr(error))
+-        startline = self.options.get('start-line', None)
+-        endline = self.options.get('end-line', None)
+-        try:
+-            if startline or (endline is not None):
+-                include_lines = include_file.readlines()
+-                include_text = ''.join(include_lines[startline:endline])
+-            else:
+-                include_text = include_file.read()
+-        except UnicodeError as error:
+-            raise self.severe(
+-                'Problem with "%s" directive:\n%s: %s'
+-                % (self.name, error.__class__.__name__, error))
+-        # start-after/end-before: no restrictions on newlines in match-text,
+-        # and no restrictions on matching inside lines vs. line boundaries
+-        after_text = self.options.get('start-after', None)
+-        if after_text:
+-            # skip content in include_text before *and incl.* a matching text
+-            after_index = include_text.find(after_text)
+-            if after_index < 0:
+-                raise self.severe('Problem with "start-after" option of "%s" '
+-                                  'directive:\nText not found.' % self.name)
+-            include_text = include_text[after_index + len(after_text):]
+-        before_text = self.options.get('end-before', None)
+-        if before_text:
+-            # skip content in include_text after *and incl.* a matching text
+-            before_index = include_text.find(before_text)
+-            if before_index < 0:
+-                raise self.severe('Problem with "end-before" option of "%s" '
+-                                  'directive:\nText not found.' % self.name)
+-            include_text = include_text[:before_index]
+-        if 'literal' in self.options:
+-            # Convert tabs to spaces, if `tab_width` is positive.
+-            if tab_width >= 0:
+-                text = include_text.expandtabs(tab_width)
+-            else:
+-                text = include_text
+-            literal_block = nodes.literal_block(include_text, text,
+-                                                source=command)
+-            literal_block.line = 1
+-            return [literal_block]
+-        else:
+-            include_lines = statemachine.string2lines(
+-                include_text, tab_width, convert_whitespace=1)
+-            self.state_machine.insert_input(include_lines, command)
+-            return []
+-
++        with tempfile.NamedTemporaryFile() as fh:
++            exitcode = subprocess.call(command_list, stdout=fh,
++                                       cwd=source_dir)
++            if exitcode != 0:
++                raise self.severe('Problems with "%s" directive:\n'
++                                  'Command %s returned with exit code %d' %
++                                  (self.name, SafeString(command), exitcode))
++
++            fh.flush()
++            self.arguments[0] = fh.name
++            return super().run()
+ 
+ def setup(app):
+     app.add_directive('pipeinclude', PipeInclude)

Deleted: packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff
===================================================================
--- packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff	2014-06-29 19:54:43 UTC (rev 11008)
+++ packages/s3ql/trunk/debian/patches/workaround_sphinx_bug_1196.diff	2014-06-29 22:05:56 UTC (rev 11009)
@@ -1,26 +0,0 @@
-Description: Work around Sphinx issue #1196
-Origin: debian
-Forwarded: no
-Last-Update: <2014-06-28>
-Author: Nikolaus Rath <Nikolaus at rath.org>
-
-This patch works around
-https://bitbucket.org/birkenfeld/sphinx/issue/1196/
-
---- a/setup.py
-+++ b/setup.py
-@@ -20,6 +20,13 @@
-                      'https://pypi.python.org/pypi/setuptools')
- from setuptools import Extension
- 
-+# Work around https://bitbucket.org/birkenfeld/sphinx/issue/1196/
-+import locale
-+import os
-+os.environ['LC_ALL'] = 'C.UTF-8'
-+os.environ['LANG'] = 'C.UTF-8'
-+locale.setlocale(locale.LC_ALL, '')
-+
- from distutils.version import LooseVersion
- import os
- import subprocess
-




More information about the Python-apps-commits mailing list