Debian Codegraph @

debian/patches/generate_snowball_offline.diff

raw
1 From: Dmitry Shachnev <[email protected]>
2 Date: Thu, 25 Dec 2025 23:36:23 +0300
3 Subject: Remove use of requests from utils/generate_snowball.py
4
5 So we can run it during the package build.
6 ---
7 utils/generate_snowball.py | 13 +------------
8 1 file changed, 1 insertion(+), 12 deletions(-)
9
10 diff --git a/utils/generate_snowball.py b/utils/generate_snowball.py
11 index 181cb01..edc7a8c 100755
12 --- a/utils/generate_snowball.py
13 +++ b/utils/generate_snowball.py
14 @@ -55,18 +55,9 @@ def regenerate_stopwords() -> None:
15 STOPWORDS_DIR.joinpath('__init__.py').touch()
16
17 for lang_code, lang_name, url in STOPWORD_URLS:
18 - content = requests.get(url, timeout=5).content
19 - try:
20 - data = content.decode('utf-8')
21 - except UnicodeDecodeError:
22 - if lang_code == 'ru':
23 - data = content.decode('koi8-r')
24 - else:
25 - data = content.decode('latin-1')
26 -
27 # record the original source of the stopwords list
28 txt_path = STOPWORDS_DIR / f'{lang_code}.txt'
29 - txt_path.write_text(data.rstrip() + '\n', encoding='utf-8')
30 + data = txt_path.read_text()
31
32 # generate the Python stopwords set
33 stopwords = parse_stop_word(data)
34 @@ -134,5 +125,3 @@ def regenerate_javascript() -> None:
35
36 if __name__ == '__main__':
37 regenerate_stopwords()
38 - if sys.platform != 'win32':
39 - regenerate_javascript()