FIXUP: Implement review comments

This commit is contained in:
Alex Pyrgiotis 2024-10-07 21:13:49 +03:00
parent 07921566ba
commit e027d853c2
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
3 changed files with 12 additions and 7 deletions

View file

@ -4,7 +4,9 @@ import sys
try: try:
from . import vendor # type: ignore [attr-defined] from . import vendor # type: ignore [attr-defined]
sys.path.insert(0, vendor.__path__[0]) vendor_path = vendor.__path__[0]
print(f"Using vendored PyMuPDF libraries from '{vendor_path}'")
sys.path.insert(0, vendor_path)
except ImportError: except ImportError:
pass pass

6
debian/rules vendored
View file

@ -1,9 +1,9 @@
#!/usr/bin/make -f #!/usr/bin/make -f
export PYBUILD_NAME=dangerzone export PYBUILD_NAME=dangerzone
export DEB_BUILD_OPTIONS=nocheck export DEB_BUILD_OPTIONS=nocheck
#export PYBUILD_INSTALL_ARGS=--install-lib=/usr/lib/python3/dist-packages export PYBUILD_INSTALL_ARGS=--install-lib=/usr/lib/python3/dist-packages
#export PYTHONDONTWRITEBYTECODE=1 export PYTHONDONTWRITEBYTECODE=1
#export DH_VERBOSE=1 export DH_VERBOSE=1
%: %:
dh $@ --with python3 --buildsystem=pybuild dh $@ --with python3 --buildsystem=pybuild

View file

@ -22,16 +22,19 @@ def main():
container_requirements_txt = subprocess.check_output(cmd) container_requirements_txt = subprocess.check_output(cmd)
print(f">>> Vendoring PyMuPDF under '{args.dest}'", file=sys.stderr) print(f">>> Vendoring PyMuPDF under '{args.dest}'", file=sys.stderr)
# We prefer to call the CLI version of `pip`, instead of importing it directly, as
# instructed here:
# https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
cmd = [ cmd = [
"python3", sys.executable,
"-m", "-m",
"pip", "pip",
"install", "install",
"--no-cache-dir", "--no-cache-dir",
"--no-compile", "--no-compile",
"-t", "--target",
args.dest, args.dest,
"-r", "--requirements",
"/proc/self/fd/0", # XXX: pip does not read requirements.txt from stdin "/proc/self/fd/0", # XXX: pip does not read requirements.txt from stdin
] ]
subprocess.check_output(cmd, input=container_requirements_txt) subprocess.check_output(cmd, input=container_requirements_txt)