mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Ignore tesseract data when building DEB/RPM packages
This commit is contained in:
parent
477bdfcc2e
commit
d1e119452e
2 changed files with 13 additions and 3 deletions
3
debian/source/options
vendored
3
debian/source/options
vendored
|
@ -2,3 +2,6 @@ compression = "gzip"
|
||||||
tar-ignore = "dev_scripts"
|
tar-ignore = "dev_scripts"
|
||||||
tar-ignore = ".*"
|
tar-ignore = ".*"
|
||||||
tar-ignore = "__pycache__"
|
tar-ignore = "__pycache__"
|
||||||
|
# Ignore the 'share/tessdata' dir, since it slows down the process, and we
|
||||||
|
# install Tesseract data via Debian packages anyway.
|
||||||
|
tar-ignore = "share/tessdata"
|
||||||
|
|
|
@ -64,10 +64,15 @@ def build(build_dir, qubes=False):
|
||||||
os.symlink(dist_path, srpm_dir)
|
os.symlink(dist_path, srpm_dir)
|
||||||
|
|
||||||
print("* Creating a Python sdist")
|
print("* Creating a Python sdist")
|
||||||
|
tessdata = root / "share" / "tessdata"
|
||||||
|
tessdata_bak = root / "tessdata.bak"
|
||||||
container_tar_gz = root / "share" / "container.tar.gz"
|
container_tar_gz = root / "share" / "container.tar.gz"
|
||||||
container_tar_gz_bak = root / "container.tar.gz.bak"
|
container_tar_gz_bak = root / "container.tar.gz.bak"
|
||||||
|
|
||||||
|
if tessdata.exists():
|
||||||
|
tessdata.rename(tessdata_bak)
|
||||||
stash_container = qubes and container_tar_gz.exists()
|
stash_container = qubes and container_tar_gz.exists()
|
||||||
if stash_container:
|
if stash_container and container_tar_gz.exists():
|
||||||
container_tar_gz.rename(container_tar_gz_bak)
|
container_tar_gz.rename(container_tar_gz_bak)
|
||||||
try:
|
try:
|
||||||
subprocess.run(["poetry", "build", "-f", "sdist"], cwd=root, check=True)
|
subprocess.run(["poetry", "build", "-f", "sdist"], cwd=root, check=True)
|
||||||
|
@ -77,7 +82,9 @@ def build(build_dir, qubes=False):
|
||||||
shutil.copy2(sdist_path, build_dir / "SOURCES" / sdist_name)
|
shutil.copy2(sdist_path, build_dir / "SOURCES" / sdist_name)
|
||||||
sdist_path.unlink()
|
sdist_path.unlink()
|
||||||
finally:
|
finally:
|
||||||
if stash_container:
|
if tessdata_bak.exists():
|
||||||
|
tessdata_bak.rename(tessdata)
|
||||||
|
if stash_container and container_tar_gz_bak.exists():
|
||||||
container_tar_gz_bak.rename(container_tar_gz)
|
container_tar_gz_bak.rename(container_tar_gz)
|
||||||
|
|
||||||
print("* Building RPM package")
|
print("* Building RPM package")
|
||||||
|
|
Loading…
Reference in a new issue