about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pypandoc
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-04-28 14:39:00 +0000
committerAlyssa Ross <hi@alyssa.is>2021-06-10 08:52:36 +0000
commit693e64ef7421374338ddb1dc12b9573feec75972 (patch)
tree2526ac075d248699c35d63e04499890ee4381f5f /nixpkgs/pkgs/development/python-modules/pypandoc
parent7014df2256694d97093d6f2bb1db340d346dea88 (diff)
parent8e4fe32876ca15e3d5eb3ecd3ca0b224417f5f17 (diff)
downloadnixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar.gz
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar.bz2
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar.lz
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar.xz
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.tar.zst
nixlib-693e64ef7421374338ddb1dc12b9573feec75972.zip
Merge commit '8e4fe32876ca15e3d5eb3ecd3ca0b224417f5f17'
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pypandoc')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pypandoc/default.nix28
-rw-r--r--nixpkgs/pkgs/development/python-modules/pypandoc/new-pandoc-headings.patch22
-rw-r--r--nixpkgs/pkgs/development/python-modules/pypandoc/skip-tests.patch20
-rw-r--r--nixpkgs/pkgs/development/python-modules/pypandoc/static-pandoc-path.patch10
4 files changed, 63 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pypandoc/default.nix b/nixpkgs/pkgs/development/python-modules/pypandoc/default.nix
index c54e220228ab..b5acf6c05438 100644
--- a/nixpkgs/pkgs/development/python-modules/pypandoc/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/pypandoc/default.nix
@@ -1,5 +1,6 @@
-{ lib, buildPythonPackage, fetchFromGitHub, fetchpatch
-, pandoc, haskellPackages, texlive }:
+{ lib, substituteAll, buildPythonPackage, fetchFromGitHub
+, pandoc, texlive
+}:
 
 buildPythonPackage rec {
   pname = "pypandoc";
@@ -12,25 +13,18 @@ buildPythonPackage rec {
     sha256 = "1lpslfns6zxx7b0xr13bzg921lwrj5am8za0b2dviywk6iiib0ld";
   };
 
-  # https://github.com/bebraw/pypandoc/pull/204
   patches = [
-    (fetchpatch {
-      url = "https://github.com/sternenseemann/pypandoc/commit/e422e277dd667c77dae11fad931dbb6015e9a784.patch";
-      sha256 = "11l11kh2a4k0h1g4yvijb60076kzxlkrvda3x6dc1s8fz352bpg3";
+    (substituteAll {
+      src = ./static-pandoc-path.patch;
+      pandoc = "${lib.getBin pandoc}/bin/pandoc";
     })
+    ./skip-tests.patch
+    ./new-pandoc-headings.patch
   ];
 
-  postPatch = ''
-    # set pandoc path statically
-    sed -i '/^__pandoc_path = None$/c__pandoc_path = "${pandoc}/bin/pandoc"' pypandoc/__init__.py
-
-    # Skip test that requires network access
-    sed -i '/test_basic_conversion_from_http_url/i\\    @unittest.skip\("no network access during checkPhase"\)' tests.py
-  '';
-
-  preCheck = ''
-    export PATH="${haskellPackages.pandoc-citeproc}/bin:${texlive.combined.scheme-small}/bin:$PATH"
-  '';
+  checkInputs = [
+    texlive.combined.scheme-small
+  ];
 
   meta = with lib; {
     description = "Thin wrapper for pandoc";
diff --git a/nixpkgs/pkgs/development/python-modules/pypandoc/new-pandoc-headings.patch b/nixpkgs/pkgs/development/python-modules/pypandoc/new-pandoc-headings.patch
new file mode 100644
index 000000000000..6716bf57d1bb
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pypandoc/new-pandoc-headings.patch
@@ -0,0 +1,22 @@
+diff --git a/tests.py b/tests.py
+index aede281..c400888 100755
+--- a/tests.py
++++ b/tests.py
+@@ -295,7 +295,7 @@ class TestPypandoc(unittest.TestCase):
+ 
+     def test_unicode_input(self):
+         # make sure that pandoc always returns unicode and does not mishandle it
+-        expected = u'üäöîôû{0}======{0}{0}'.format(os.linesep)
++        expected = u'# üäöîôû'.format(os.linesep)
+         written = pypandoc.convert_text(u'<h1>üäöîôû</h1>', 'md', format='html')
+         self.assertTrue(isinstance(written, unicode_type))
+         self.assertEqualExceptForNewlineEnd(expected, written)
+@@ -305,7 +305,7 @@ class TestPypandoc(unittest.TestCase):
+         self.assertTrue(isinstance(written, unicode_type))
+ 
+         # Only use german umlauts in th next test, as iso-8859-15 covers that
+-        expected = u'üäö€{0}===={0}{0}'.format(os.linesep)
++        expected = u'# üäö€'.format(os.linesep)
+         bytes = u'<h1>üäö€</h1>'.encode("iso-8859-15")
+ 
+         # Without encoding, this fails as we expect utf-8 per default
diff --git a/nixpkgs/pkgs/development/python-modules/pypandoc/skip-tests.patch b/nixpkgs/pkgs/development/python-modules/pypandoc/skip-tests.patch
new file mode 100644
index 000000000000..d8f7f9721777
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pypandoc/skip-tests.patch
@@ -0,0 +1,20 @@
+diff --git a/tests.py b/tests.py
+index deb50e0..aede281 100755
+--- a/tests.py
++++ b/tests.py
+@@ -179,6 +179,7 @@ class TestPypandoc(unittest.TestCase):
+             received = pypandoc.convert_file(file_url, 'rst')
+             self.assertEqualExceptForNewlineEnd(expected, received)
+ 
++    @unittest.skip("no network access during checkPhase")
+     def test_basic_conversion_from_http_url(self):
+         url = 'https://raw.githubusercontent.com/bebraw/pypandoc/master/README.md'
+         received = pypandoc.convert_file(url, 'html')
+@@ -247,6 +248,7 @@ class TestPypandoc(unittest.TestCase):
+ 
+         self.assertRaises(RuntimeError, f)
+ 
++    @unittest.skip("pandoc-citeproc has been deprecated")
+     def test_conversion_with_citeproc_filter(self):
+         # we just want to get a temp file name, where we can write to
+         filters = ['pandoc-citeproc']
diff --git a/nixpkgs/pkgs/development/python-modules/pypandoc/static-pandoc-path.patch b/nixpkgs/pkgs/development/python-modules/pypandoc/static-pandoc-path.patch
new file mode 100644
index 000000000000..bb495e78bea6
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pypandoc/static-pandoc-path.patch
@@ -0,0 +1,10 @@
+diff --git a/pypandoc/__init__.py b/pypandoc/__init__.py
+index 6d5b79b..65437aa 100644
+--- a/pypandoc/__init__.py
++++ b/pypandoc/__init__.py
+@@ -582,4 +582,4 @@ def clean_pandocpath_cache():
+ 
+ 
+ __version = None
+-__pandoc_path = None
++__pandoc_path = "@pandoc@"