Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upstream code tries to downloads iso-codes during build. To avoid this add a dependency on misc/iso-codes port extract and patch the code to copy the required files from there.
- Loading branch information
1 parent
4415877
commit 14c120d
Showing
5 changed files
with
128 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
TIMESTAMP = 1688111798 | ||
SHA256 (calibre/calibre-6.22.0.tar.xz) = 4c15dd11fe8c04feb885e63ab8069526d65cf929e117804d26085c0ae4e8a547 | ||
SIZE (calibre/calibre-6.22.0.tar.xz) = 42822576 | ||
TIMESTAMP = 1689333206 | ||
SHA256 (calibre/calibre-6.23.0.tar.xz) = 5d7e75d6452d2f89694aca7d253b87ac625de0ce82840e8fc18e5e9e7db37fc2 | ||
SIZE (calibre/calibre-6.23.0.tar.xz) = 42881840 | ||
SHA256 (calibre/cacert.pem) = fb1ecd641d0a02c01bc9036d513cb658bbda62a75e246bedbc01764560a639f0 | ||
SIZE (calibre/cacert.pem) = 216583 | ||
SHA256 (calibre/kovidgoyal-calibre-translations-d911cab_GH0.tar.gz) = 625b6bed69e376bd05de2b1b76e1c2b21846e31beb6bb2e957cf2aa472c29fb7 | ||
SIZE (calibre/kovidgoyal-calibre-translations-d911cab_GH0.tar.gz) = 71813621 | ||
SHA256 (calibre/LibreOffice-dictionaries-8b6fc85_GH0.tar.gz) = dcbdeddb3c7c8df2d340ae381bbefd8ee6a64b7a6c79a6ad6e0d095463dcd2a3 | ||
SIZE (calibre/LibreOffice-dictionaries-8b6fc85_GH0.tar.gz) = 94696029 | ||
SHA256 (calibre/kovidgoyal-calibre-translations-41c9da0_GH0.tar.gz) = 0f16c90262365bae388b4d7f6211b5ce75e5be2c5057640a36d915f9db118a02 | ||
SIZE (calibre/kovidgoyal-calibre-translations-41c9da0_GH0.tar.gz) = 71814203 | ||
SHA256 (calibre/LibreOffice-dictionaries-d1ddba9_GH0.tar.gz) = 47e10a74859c772592713f1e37b48678453483a1745411bbbac549ecdb0440a1 | ||
SIZE (calibre/LibreOffice-dictionaries-d1ddba9_GH0.tar.gz) = 94695596 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- setup/iso_codes.py.orig 2023-07-14 01:29:18 UTC | ||
+++ setup/iso_codes.py | ||
@@ -1,42 +1,24 @@ | ||
#!/usr/bin/env python | ||
# License: GPLv3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net> | ||
-import fnmatch | ||
+import glob | ||
import os | ||
-import shutil, time | ||
-import zipfile | ||
-from io import BytesIO | ||
+import shutil | ||
|
||
-from setup import download_securely | ||
|
||
- | ||
class ISOData: | ||
- URL = 'https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/main/iso-codes-main.zip' | ||
- | ||
- def __init__(self): | ||
- self._zip_data = None | ||
- | ||
- @property | ||
- def zip_data(self): | ||
- if self._zip_data is None: | ||
- self._zip_data = BytesIO(download_securely(self.URL)) | ||
- return self._zip_data | ||
- | ||
def db_data(self, name: str) -> bytes: | ||
- with zipfile.ZipFile(self.zip_data) as zf: | ||
- with zf.open(f'iso-codes-main/data/{name}') as f: | ||
- return f.read() | ||
+ src = f'%%ISOCODESWRKSRC%%/data/{name}' | ||
+ if not os.path.exists(src): | ||
+ raise Exception(src + ' does not exist') | ||
+ with open(src, 'rb') as f: | ||
+ return f.read() | ||
|
||
def extract_po_files(self, name: str, output_dir: str) -> None: | ||
name = name.split('.', 1)[0] | ||
- pat = f'iso-codes-main/{name}/*.po' | ||
- with zipfile.ZipFile(self.zip_data) as zf: | ||
- for name in fnmatch.filter(zf.namelist(), pat): | ||
- dest = os.path.join(output_dir, name.split('/')[-1]) | ||
- zi = zf.getinfo(name) | ||
- with zf.open(zi) as src, open(dest, 'wb') as d: | ||
- shutil.copyfileobj(src, d) | ||
- date_time = time.mktime(zi.date_time + (0, 0, -1)) | ||
- os.utime(dest, (date_time, date_time)) | ||
+ pat = f'%%ISOCODESWRKSRC%%/{name}/*.po' | ||
+ for name in glob.glob(pat): | ||
+ dest = os.path.join(output_dir, name.split('/')[-1]) | ||
+ shutil.copy2(name, dest) | ||
|
||
iso_data = ISOData() |
Oops, something went wrong.