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

This commit is contained in:
Robert Obryk 2022-12-03 05:24:23 +01:00 committed by GitHub
parent 43cc2746c6
commit bbbb55d3ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 2 deletions

View file

@ -2,12 +2,13 @@
, buildPythonPackage
, distro
, fetchFromGitHub
, jdk
, jre
, numpy
, pandas
, pytestCheckHook
, pythonOlder
, setuptools-scm
, setuptools
}:
buildPythonPackage rec {
@ -24,6 +25,14 @@ buildPythonPackage rec {
hash = "sha256-Dfi6LzrLDz9VVDmbeK1dEaWuQosD4tvAH13Q4Mp3smA=";
};
patches = [
./java-interpreter-path.patch
];
postPatch = ''
sed -i 's|@JAVA@|${jre}/bin/java|g' $(find -name '*.py')
'';
SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeBuildInputs = [
@ -34,10 +43,10 @@ buildPythonPackage rec {
distro
numpy
pandas
setuptools
];
checkInputs = [
jdk
pytestCheckHook
];

View file

@ -0,0 +1,54 @@
diff -ru origsource/tabula/io.py source/tabula/io.py
--- origsource/tabula/io.py 2022-11-23 17:19:35.419837514 +0100
+++ source/tabula/io.py 2022-11-23 17:22:08.204194807 +0100
@@ -79,7 +79,7 @@
)
)
- args = ["java"] + java_options + ["-jar", _jar_path()] + options.build_option_list()
+ args = ["@JAVA@"] + java_options + ["-jar", _jar_path()] + options.build_option_list()
if path:
args.append(path)
diff -ru origsource/tabula/util.py source/tabula/util.py
--- origsource/tabula/util.py 2022-11-23 17:19:35.422837521 +0100
+++ source/tabula/util.py 2022-11-23 17:21:41.514132392 +0100
@@ -26,7 +26,7 @@
try:
res = subprocess.check_output(
- ["java", "-version"], stderr=subprocess.STDOUT
+ ["@JAVA@", "-version"], stderr=subprocess.STDOUT
).decode()
except FileNotFoundError:
diff -ru origsource/tests/test_read_pdf_table.py source/tests/test_read_pdf_table.py
--- origsource/tests/test_read_pdf_table.py 2022-11-23 17:19:35.422837521 +0100
+++ source/tests/test_read_pdf_table.py 2022-11-23 17:21:22.008086776 +0100
@@ -281,7 +281,7 @@
tabula.read_pdf(self.pdf_path, encoding="utf-8")
- target_args = ["java"]
+ target_args = ["@JAVA@"]
if platform.system() == "Darwin":
target_args += ["-Djava.awt.headless=true"]
target_args += [
@@ -355,7 +355,7 @@
tabula.read_pdf(self.pdf_path, encoding="utf-8", silent=False)
- target_args = ["java"]
+ target_args = ["@JAVA@"]
if platform.system() == "Darwin":
target_args += ["-Djava.awt.headless=true"]
target_args += [
@@ -382,7 +382,7 @@
tabula.read_pdf(self.pdf_path, encoding="utf-8", silent=True)
- target_args = ["java"]
+ target_args = ["@JAVA@"]
if platform.system() == "Darwin":
target_args += ["-Djava.awt.headless=true"]
target_args += [