Control: tags 897111 + patch
Control: tags 897111 + pending

Dear maintainer,

I've prepared an NMU for pypandoc (versioned as 1.4+ds0-1.1) and
uploaded it to DELAYED/2. Please feel free to tell me if I
should delay it longer.

Cheers
-- 
Sebastian Ramacher
diff -Nru pypandoc-1.4+ds0/debian/changelog pypandoc-1.4+ds0/debian/changelog
--- pypandoc-1.4+ds0/debian/changelog	2017-06-18 17:50:07.000000000 +0200
+++ pypandoc-1.4+ds0/debian/changelog	2018-05-21 11:00:13.000000000 +0200
@@ -1,3 +1,11 @@
+pypandoc (1.4+ds0-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/patches: Apply upstream patches to fix compatibility with recent
+    pandoc versions. (Closes: #897111)
+
+ -- Sebastian Ramacher <sramac...@debian.org>  Mon, 21 May 2018 11:00:13 +0200
+
 pypandoc (1.4+ds0-1) unstable; urgency=medium
 
   * New upstream version
diff -Nru pypandoc-1.4+ds0/debian/patches/0003-Fix-tests-with-newer-pandoc.patch pypandoc-1.4+ds0/debian/patches/0003-Fix-tests-with-newer-pandoc.patch
--- pypandoc-1.4+ds0/debian/patches/0003-Fix-tests-with-newer-pandoc.patch	1970-01-01 01:00:00.000000000 +0100
+++ pypandoc-1.4+ds0/debian/patches/0003-Fix-tests-with-newer-pandoc.patch	2018-05-21 10:57:11.000000000 +0200
@@ -0,0 +1,159 @@
+From ea9d2642f91489646b56faf13d8a852e7b737b0b Mon Sep 17 00:00:00 2001
+From: Jan Schulz <j...@gmx.net>
+Date: Fri, 6 Apr 2018 02:03:32 +0200
+Subject: [PATCH] Fix tests with newer pandoc
+
+---
+ tests.py | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+--- a/tests.py
++++ b/tests.py
+@@ -134,7 +134,7 @@
+         self.assertTrue(isinstance(version, pypandoc.string_types))
+         major = int(version.split(".")[0])
+         # according to http://pandoc.org/releases.html there were only two versions 0.x ...
+-        self.assertTrue(major in [0, 1])
++        self.assertTrue(major in [0, 1, 2])
+ 
+     def test_converts_valid_format(self):
+         self.assertEqualExceptForNewlineEnd(pypandoc.convert("ok", format='md', to='rest'), 'ok')
+@@ -150,7 +150,7 @@
+         self.assertRaises(RuntimeError, f)
+ 
+     def test_basic_conversion_from_file(self):
+-        with closed_tempfile('.md', text='#some title\n') as file_name:
++        with closed_tempfile('.md', text='# some title\n') as file_name:
+             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+             received = pypandoc.convert(file_name, 'rst')
+             self.assertEqualExceptForNewlineEnd(expected, received)
+@@ -158,7 +158,7 @@
+     def test_basic_conversion_from_file_url(self):
+         # this currently doesn't work: https://github.com/jgm/pandoc/issues/3196
+         return
+-        with closed_tempfile('.md', text='#some title\n') as file_name:
++        with closed_tempfile('.md', text='# some title\n') as file_name:
+             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+             # this keeps the : (which should be '|' on windows but pandoc
+             # doesn't like it
+@@ -176,14 +176,14 @@
+ 
+     def test_convert_with_custom_writer(self):
+         lua_file_content = self.create_sample_lua()
+-        with closed_tempfile('.md', text='#title\n') as file_name:
++        with closed_tempfile('.md', text='# title\n') as file_name:
+             with closed_tempfile('.lua', text=lua_file_content, dir_name="foo-bar+baz") as lua_file_name:
+                 expected = u'<h1 id="title">title</h1>{0}'.format(os.linesep)
+                 received = pypandoc.convert_file(file_name, lua_file_name)
+                 self.assertEqualExceptForNewlineEnd(expected, received)
+ 
+     def test_basic_conversion_from_file_with_format(self):
+-        with closed_tempfile('.md', text='#some title\n') as file_name:
++        with closed_tempfile('.md', text='# some title\n') as file_name:
+             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+             received = pypandoc.convert(file_name, 'rst', format='md')
+             self.assertEqualExceptForNewlineEnd(expected, received)
+@@ -193,11 +193,11 @@
+ 
+     def test_basic_conversion_from_string(self):
+         expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+-        received = pypandoc.convert('#some title', 'rst', format='md')
++        received = pypandoc.convert('# some title', 'rst', format='md')
+         self.assertEqualExceptForNewlineEnd(expected, received)
+ 
+         expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+-        received = pypandoc.convert_text('#some title', 'rst', format='md')
++        received = pypandoc.convert_text('# some title', 'rst', format='md')
+         self.assertEqualExceptForNewlineEnd(expected, received)
+ 
+     def test_conversion_with_markdown_extensions(self):
+@@ -215,16 +215,16 @@
+     def test_conversion_from_markdown_with_extensions(self):
+         input = u'~~strike~~'
+         expected_with_extension = u'<p><del>strike</del></p>'
+-        expected_without_extension = u'<p><sub><sub>strike</sub></sub></p>'
++        #expected_without_extension = u'<p><sub><sub>strike</sub></sub></p>'
+         received_with_extension = pypandoc.convert(input, 'html', format=u'markdown+strikeout')
+-        received_without_extension = pypandoc.convert(input, 'html', format=u'markdown-strikeout')
++        #received_without_extension = pypandoc.convert(input, 'html', format=u'markdown-strikeout')
+         self.assertEqualExceptForNewlineEnd(expected_with_extension, received_with_extension)
+-        self.assertEqualExceptForNewlineEnd(expected_without_extension, received_without_extension)
++        #self.assertEqualExceptForNewlineEnd(expected_without_extension, received_without_extension)
+ 
+     def test_basic_conversion_to_file(self):
+         with closed_tempfile('.rst',) as file_name:
+             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+-            received = pypandoc.convert('#some title\n', to='rst', format='md', outputfile=file_name)
++            received = pypandoc.convert('# some title\n', to='rst', format='md', outputfile=file_name)
+             self.assertEqualExceptForNewlineEnd("", received)
+             with io.open(file_name) as f:
+                 written = f.read()
+@@ -232,7 +232,7 @@
+ 
+         # to odf does not work without a file
+         def f():
+-            pypandoc.convert('#some title\n', to='odf', format='md',
++            pypandoc.convert('# some title\n', to='odf', format='md',
+                              outputfile=None)
+         self.assertRaises(RuntimeError, f)
+ 
+@@ -313,14 +313,14 @@
+             expected = u'some title{0}=========={0}{0}'.format(os.linesep)
+             # let's just test conversion (to and) from docx, testing e.g. odt
+             # as well would really be testing pandoc rather than pypandoc
+-            received = pypandoc.convert('#some title\n', to='docx', format='md', outputfile=file_name)
++            received = pypandoc.convert('# some title\n', to='docx', format='md', outputfile=file_name)
+             self.assertEqualExceptForNewlineEnd("", received)
+             received = pypandoc.convert(file_name, to='rst')
+             self.assertEqualExceptForNewlineEnd(expected, received)
+ 
+     def test_pdf_conversion(self):
+         with closed_tempfile('.pdf') as file_name:
+-            ret = pypandoc.convert_text('#some title\n', to='pdf', format='md', outputfile=file_name)
++            ret = pypandoc.convert_text('# some title\n', to='pdf', format='md', outputfile=file_name)
+             assert ret == ""
+             with io.open(file_name, mode='rb') as f:
+                 written = f.read()
+@@ -329,21 +329,21 @@
+ 
+         def f():
+             # needs an outputfile
+-            pypandoc.convert_text('#some title\n', to='pdf', format='md')
++            pypandoc.convert_text('# some title\n', to='pdf', format='md')
+ 
+         self.assertRaises(RuntimeError, f)
+ 
+         # outputfile needs to end in pdf
+         with closed_tempfile('.WRONG') as file_name:
+             def f():
+-                pypandoc.convert_text('#some title\n', to='pdf', format='md', outputfile=file_name)
++                pypandoc.convert_text('# some title\n', to='pdf', format='md', outputfile=file_name)
+ 
+             self.assertRaises(RuntimeError, f)
+ 
+         # no extensions allowed
+         with closed_tempfile('.pdf') as file_name:
+             def f():
+-                pypandoc.convert_text('#some title\n', to='pdf+somethign', format='md', outputfile=file_name)
++                pypandoc.convert_text('# some title\n', to='pdf+somethign', format='md', outputfile=file_name)
+ 
+             self.assertRaises(RuntimeError, f)
+ 
+@@ -372,7 +372,7 @@
+             self.assertRaises(RuntimeError, f, filepath)
+ 
+     def test_convert_text_with_existing_file(self):
+-        with closed_tempfile('.md', text='#some title\n') as file_name:
++        with closed_tempfile('.md', text='# some title\n') as file_name:
+             received = pypandoc.convert_text(file_name, 'rst', format='md')
+             self.assertTrue("title" not in received)
+ 
+@@ -383,7 +383,7 @@
+     def test_depreaction_warnings(self):
+         # convert itself is deprecated...
+         with assert_produces_warning(DeprecationWarning):
+-            pypandoc.convert('#some title\n', to='rst', format='md')
++            pypandoc.convert('# some title\n', to='rst', format='md')
+ 
+     def create_sample_lua(self):
+         args = [pypandoc.get_pandoc_path(), '--print-default-data-file', 'sample.lua']
diff -Nru pypandoc-1.4+ds0/debian/patches/0004-Workaround-a-problem-with-uppercase-lua-filenames-in-pandoc.patch pypandoc-1.4+ds0/debian/patches/0004-Workaround-a-problem-with-uppercase-lua-filenames-in-pandoc.patch
--- pypandoc-1.4+ds0/debian/patches/0004-Workaround-a-problem-with-uppercase-lua-filenames-in-pandoc.patch	1970-01-01 01:00:00.000000000 +0100
+++ pypandoc-1.4+ds0/debian/patches/0004-Workaround-a-problem-with-uppercase-lua-filenames-in-pandoc.patch	2018-05-21 10:58:59.000000000 +0200
@@ -0,0 +1,62 @@
+From 0d12f7d04eb746e41241657afcdb38ebe0af7e0d Mon Sep 17 00:00:00 2001
+From: Jan Schulz <j...@gmx.net>
+Date: Sun, 29 Apr 2018 19:03:18 +0200
+Subject: [PATCH] Workaround a problem with uppercase lua filenames in pandoc
+
+---
+ tests.py | 39 ++++++++++++++++++++++++---------------
+ 1 file changed, 24 insertions(+), 15 deletions(-)
+
+--- a/tests.py
++++ b/tests.py
+@@ -16,19 +16,27 @@
+ 
+ 
+ @contextlib.contextmanager
+-def closed_tempfile(suffix, text=None, dir_name=None):
+-    if dir_name:
+-        dir_name = tempfile.mkdtemp(suffix=dir_name)
+-    with tempfile.NamedTemporaryFile('w+t', suffix=suffix, delete=False, dir=dir_name) as test_file:
+-        file_name = test_file.name
+-        if text:
+-            test_file.write(text)
+-            test_file.flush()
+-    yield file_name
+-    if dir_name:
+-        shutil.rmtree(dir_name, ignore_errors=True)
+-    else:
+-        os.remove(file_name)
++def closed_tempfile(suffix, text=None, dir_name=None, check_case=False):
++    file_name = None
++    try:
++        if dir_name:
++            dir_name = tempfile.mkdtemp(suffix=dir_name)
++
++        with tempfile.NamedTemporaryFile('w+t', suffix=suffix, delete=False, dir=dir_name) as test_file:
++            file_name = test_file.name
++            if text:
++                test_file.write(text)
++                test_file.flush()
++        if check_case and file_name != file_name.lower():
++            # there is a bug in pandoc which can't work with uppercase lua files
++            # https://github.com/jgm/pandoc/issues/4610
++            raise unittest.SkipTest("pandoc has problems with uppercase filenames, got %s" % file_name)
++        yield file_name
++    finally:
++        if dir_name:
++            shutil.rmtree(dir_name, ignore_errors=True)
++        elif file_name:
++            os.remove(file_name)
+ 
+ 
+ # Stolen from pandas
+@@ -177,7 +185,8 @@
+     def test_convert_with_custom_writer(self):
+         lua_file_content = self.create_sample_lua()
+         with closed_tempfile('.md', text='# title\n') as file_name:
+-            with closed_tempfile('.lua', text=lua_file_content, dir_name="foo-bar+baz") as lua_file_name:
++            with closed_tempfile('.lua', text=lua_file_content, dir_name="foo-bar+baz",
++                                 check_case=True) as lua_file_name:
+                 expected = u'<h1 id="title">title</h1>{0}'.format(os.linesep)
+                 received = pypandoc.convert_file(file_name, lua_file_name)
+                 self.assertEqualExceptForNewlineEnd(expected, received)
diff -Nru pypandoc-1.4+ds0/debian/patches/series pypandoc-1.4+ds0/debian/patches/series
--- pypandoc-1.4+ds0/debian/patches/series	2017-06-18 17:50:07.000000000 +0200
+++ pypandoc-1.4+ds0/debian/patches/series	2018-05-21 10:57:04.000000000 +0200
@@ -1,2 +1,4 @@
 0001-Skip-test-s-that-require-the-network.patch
 0002-Fix-parsing-of-unicode-paths-on-non-unicode-locales.patch
+0003-Fix-tests-with-newer-pandoc.patch
+0004-Workaround-a-problem-with-uppercase-lua-filenames-in-pandoc.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to