mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
FIXUP: Fix for vendoring PyMuPDF
This commit is contained in:
parent
6fd0f925a8
commit
25ac980b0b
1 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
@ -21,6 +22,10 @@ def main():
|
|||
cmd = ["poetry", "export", "--only", "container"]
|
||||
container_requirements_txt = subprocess.check_output(cmd)
|
||||
|
||||
# XXX: Hack for Ubuntu Focal.
|
||||
if sys.version.startswith("3.8"):
|
||||
container_requirements_txt = container_requirements_txt.replace(b"3.9", b"3.8")
|
||||
|
||||
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:
|
||||
|
@ -37,7 +42,11 @@ def main():
|
|||
"--requirement",
|
||||
"/proc/self/fd/0", # XXX: pip does not read requirements.txt from stdin
|
||||
]
|
||||
subprocess.check_output(cmd, input=container_requirements_txt)
|
||||
subprocess.run(cmd, check=True, input=container_requirements_txt)
|
||||
|
||||
if not os.listdir(args.dest):
|
||||
print(f">>> Failed to vendor PyMuPDF under '{args.dest}'", file=sys.stderr)
|
||||
|
||||
|
||||
print(f">>> Successfully vendored PyMuPDF under '{args.dest}'", file=sys.stderr)
|
||||
|
||||
|
|
Loading…
Reference in a new issue