about summary refs log tree commit diff
path: root/pkgs/tools/misc/pandoc-secnos
diff options
context:
space:
mode:
authorJeroen Versteeg <jv@1nnovat.io>2022-05-06 18:27:00 +0200
committerJeroen Versteeg <jv@1nnovat.io>2022-05-06 18:38:29 +0200
commit62511c6de31dd81c2ea07a4cd37e38cb6dee5b29 (patch)
tree94ee66dfcf007558313ce49532d0b61da7a16545 /pkgs/tools/misc/pandoc-secnos
parent2e563123bf6ed58fa85626686a27208a9c96348d (diff)
pandoc-secnos: init at 2.2.2
Diffstat (limited to 'pkgs/tools/misc/pandoc-secnos')
-rw-r--r--pkgs/tools/misc/pandoc-secnos/default.nix34
-rw-r--r--pkgs/tools/misc/pandoc-secnos/patch/fix-manifest.patch39
2 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/tools/misc/pandoc-secnos/default.nix b/pkgs/tools/misc/pandoc-secnos/default.nix
new file mode 100644
index 0000000000000..95c67dde0ec0d
--- /dev/null
+++ b/pkgs/tools/misc/pandoc-secnos/default.nix
@@ -0,0 +1,34 @@
+{ buildPythonApplication
+, fetchFromGitHub
+, lib
+, pandoc-xnos
+}:
+
+buildPythonApplication rec {
+  pname = "pandoc-secnos";
+  version = "2.2.2";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "tomduck";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-J9KLZvioYM3Pl2UXjrEgd4PuLTwCLYy9SsJIzgw5/jU=";
+  };
+
+  propagatedBuildInputs = [ pandoc-xnos ];
+
+  patches = [
+    ./patch/fix-manifest.patch
+  ];
+
+  # Different pandoc executables are not available
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Standalone pandoc filter from the pandoc-xnos suite for numbering sections and section references";
+    homepage = "https://github.com/tomduck/pandoc-secnos";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ ppenguin ];
+  };
+}
diff --git a/pkgs/tools/misc/pandoc-secnos/patch/fix-manifest.patch b/pkgs/tools/misc/pandoc-secnos/patch/fix-manifest.patch
new file mode 100644
index 0000000000000..782e5b5e07c7c
--- /dev/null
+++ b/pkgs/tools/misc/pandoc-secnos/patch/fix-manifest.patch
@@ -0,0 +1,39 @@
+From 165ee1f4c1208636254392335d34934dc50d273e Mon Sep 17 00:00:00 2001
+From: ppenguin <hieronymusv@gmail.com>
+Date: Tue, 15 Mar 2022 23:15:07 +0100
+Subject: [PATCH] fix setup.py to work in nixpkgs
+
+---
+ setup.py | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index d705846..d7345a2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -42,10 +42,10 @@
+ 
+     author='Thomas J. Duck',
+     author_email='tomduck@tomduck.ca',
+-    description='Equation number filter for pandoc',
++    description='Section number filter for pandoc',
+     long_description=DESCRIPTION,
+     license='GPL',
+-    keywords='pandoc equation numbers filter',
++    keywords='pandoc section numbers filter',
+     url='https://github.com/tomduck/pandoc-secnos',
+     download_url='https://github.com/tomduck/pandoc-secnos/tarball/' + \
+                  __version__,
+@@ -63,12 +63,3 @@
+         'Programming Language :: Python'
+         ]
+ )
+-
+-# Check that the pandoc-secnos script is on the PATH
+-if not shutil.which('pandoc-secnos'):
+-    msg = """
+-          ERROR: `pandoc-secnos` script not found. This will need to 
+-          be corrected.  If you need help, please file an Issue at
+-          https://github.com/tomduck/pandoc-secnos/issues.\n"""
+-    print(textwrap.dedent(msg))
+-    sys.exit(-1)