Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

python310Packages.tabula-py: build a self-contained package and fix missing pkg_resources (#202554)

authored by Robert Obryk and committed by GitHub bbbb55d3 43cc2746

+65 -2
+11 -2
pkgs/development/python-modules/tabula-py/default.nix
··· 2 2 , buildPythonPackage 3 3 , distro 4 4 , fetchFromGitHub 5 - , jdk 5 + , jre 6 6 , numpy 7 7 , pandas 8 8 , pytestCheckHook 9 9 , pythonOlder 10 10 , setuptools-scm 11 + , setuptools 11 12 }: 12 13 13 14 buildPythonPackage rec { ··· 24 25 hash = "sha256-Dfi6LzrLDz9VVDmbeK1dEaWuQosD4tvAH13Q4Mp3smA="; 25 26 }; 26 27 28 + patches = [ 29 + ./java-interpreter-path.patch 30 + ]; 31 + 32 + postPatch = '' 33 + sed -i 's|@JAVA@|${jre}/bin/java|g' $(find -name '*.py') 34 + ''; 35 + 27 36 SETUPTOOLS_SCM_PRETEND_VERSION = version; 28 37 29 38 nativeBuildInputs = [ ··· 34 43 distro 35 44 numpy 36 45 pandas 46 + setuptools 37 47 ]; 38 48 39 49 checkInputs = [ 40 - jdk 41 50 pytestCheckHook 42 51 ]; 43 52
+54
pkgs/development/python-modules/tabula-py/java-interpreter-path.patch
··· 1 + diff -ru origsource/tabula/io.py source/tabula/io.py 2 + --- origsource/tabula/io.py 2022-11-23 17:19:35.419837514 +0100 3 + +++ source/tabula/io.py 2022-11-23 17:22:08.204194807 +0100 4 + @@ -79,7 +79,7 @@ 5 + ) 6 + ) 7 + 8 + - args = ["java"] + java_options + ["-jar", _jar_path()] + options.build_option_list() 9 + + args = ["@JAVA@"] + java_options + ["-jar", _jar_path()] + options.build_option_list() 10 + if path: 11 + args.append(path) 12 + 13 + diff -ru origsource/tabula/util.py source/tabula/util.py 14 + --- origsource/tabula/util.py 2022-11-23 17:19:35.422837521 +0100 15 + +++ source/tabula/util.py 2022-11-23 17:21:41.514132392 +0100 16 + @@ -26,7 +26,7 @@ 17 + 18 + try: 19 + res = subprocess.check_output( 20 + - ["java", "-version"], stderr=subprocess.STDOUT 21 + + ["@JAVA@", "-version"], stderr=subprocess.STDOUT 22 + ).decode() 23 + 24 + except FileNotFoundError: 25 + diff -ru origsource/tests/test_read_pdf_table.py source/tests/test_read_pdf_table.py 26 + --- origsource/tests/test_read_pdf_table.py 2022-11-23 17:19:35.422837521 +0100 27 + +++ source/tests/test_read_pdf_table.py 2022-11-23 17:21:22.008086776 +0100 28 + @@ -281,7 +281,7 @@ 29 + 30 + tabula.read_pdf(self.pdf_path, encoding="utf-8") 31 + 32 + - target_args = ["java"] 33 + + target_args = ["@JAVA@"] 34 + if platform.system() == "Darwin": 35 + target_args += ["-Djava.awt.headless=true"] 36 + target_args += [ 37 + @@ -355,7 +355,7 @@ 38 + 39 + tabula.read_pdf(self.pdf_path, encoding="utf-8", silent=False) 40 + 41 + - target_args = ["java"] 42 + + target_args = ["@JAVA@"] 43 + if platform.system() == "Darwin": 44 + target_args += ["-Djava.awt.headless=true"] 45 + target_args += [ 46 + @@ -382,7 +382,7 @@ 47 + 48 + tabula.read_pdf(self.pdf_path, encoding="utf-8", silent=True) 49 + 50 + - target_args = ["java"] 51 + + target_args = ["@JAVA@"] 52 + if platform.system() == "Darwin": 53 + target_args += ["-Djava.awt.headless=true"] 54 + target_args += [