File: 2003_unicode.patch

package info (click to toggle)
meli 0.8.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,524 kB
  • sloc: python: 809; ansic: 388; sh: 262; makefile: 206
file content (81 lines) | stat: -rw-r--r-- 3,138 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Description: generate unicode tables during build
Author: Jonas Smedegaard <dr@jones.dk>
Forwarded: not-needed
Last-Update: 2023-12-05
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/melib/build.rs
+++ b/melib/build.rs
@@ -31,19 +31,18 @@
         println!("cargo:rerun-if-changed={MOD_PATH}");
         /* Line break tables */
         use std::{
-            fs::File,
+            fs::{self, File},
             io::{prelude::*, BufReader},
             path::Path,
-            process::{Command, Stdio},
         };
         const LINE_BREAK_TABLE_URL: &str =
-            "http://www.unicode.org/Public/UCD/latest/ucd/LineBreak.txt";
+            "/usr/share/unicode/LineBreak.txt";
         /* Grapheme width tables */
         const UNICODE_DATA_URL: &str =
-            "http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt";
-        const EAW_URL: &str = "http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt";
+            "/usr/share/unicode/UnicodeData.txt";
+        const EAW_URL: &str = "/usr/share/unicode/EastAsianWidth.txt";
         const EMOJI_DATA_URL: &str =
-            "https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt";
+            "/usr/share/unicode/emoji/emoji-data.txt";
 
         let mod_path = Path::new(MOD_PATH);
         if mod_path.exists() {
@@ -53,14 +52,7 @@
             );
             return Ok(());
         }
-        let mut child = Command::new("curl")
-            .args(["-o", "-", LINE_BREAK_TABLE_URL])
-            .stdout(Stdio::piped())
-            .stdin(Stdio::null())
-            .stderr(Stdio::inherit())
-            .spawn()?;
-
-        let buf_reader = BufReader::new(child.stdout.take().unwrap());
+        let buf_reader = BufReader::new(File::open(LINE_BREAK_TABLE_URL)?);
 
         let mut line_break_table: Vec<(u32, u32, LineBreakClass)> = Vec::with_capacity(3800);
         for line in buf_reader.lines() {
@@ -87,28 +79,12 @@
             let class = &tokens[semicolon_idx + 1..semicolon_idx + 1 + 2];
             line_break_table.push((first_codepoint, sec_codepoint, LineBreakClass::from(class)));
         }
-        child.wait()?;
-
-        let child = Command::new("curl")
-            .args(["-o", "-", UNICODE_DATA_URL])
-            .stdout(Stdio::piped())
-            .output()?;
-
-        let unicode_data = String::from_utf8_lossy(&child.stdout);
-
-        let child = Command::new("curl")
-            .args(["-o", "-", EAW_URL])
-            .stdout(Stdio::piped())
-            .output()?;
 
-        let eaw_data = String::from_utf8_lossy(&child.stdout);
+        let unicode_data = fs::read_to_string(UNICODE_DATA_URL)?;
 
-        let child = Command::new("curl")
-            .args(["-o", "-", EMOJI_DATA_URL])
-            .stdout(Stdio::piped())
-            .output()?;
+        let eaw_data = fs::read_to_string(EAW_URL)?;
 
-        let emoji_data = String::from_utf8_lossy(&child.stdout);
+        let emoji_data = fs::read_to_string(EMOJI_DATA_URL)?;
 
         const MAX_CODEPOINT: usize = 0x110000;
         // See https://www.unicode.org/L2/L1999/UnicodeData.html