public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/langpacks] rawhide: Embed python script to avoid an error on rpmautospec
@ 2026-10-06 3:46 Akira TAGOH
0 siblings, 0 replies; only message in thread
From: Akira TAGOH @ 2026-10-06 3:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/langpacks
Branch : rawhide
Commit : 56eddfced77e2b7a097d12a2ba6dc49191af3ad0
Author : Akira TAGOH <akira@tagoh.org>
Date : 2026-09-30T15:30:53+09:00
Stats : +11/-11 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/langpacks/c/56eddfced77e2b7a097d12a2ba6dc49191af3ad0?branch=rawhide
Log:
Embed python script to avoid an error on rpmautospec
[skip changelog]
---
diff --git a/langpacks.spec b/langpacks.spec
index 1d2d005..599c90e 100644
--- a/langpacks.spec
+++ b/langpacks.spec
@@ -6,7 +6,6 @@ Summary: Langpacks meta-package
License: GPL-2.0-or-later
BuildArch: noarch
BuildRequires: python3 fontconfig
-Source4: normlang.py
# to split up the AppStream file
BuildRequires: libappstream-glib >= 0.5.10
@@ -1556,9 +1555,17 @@ for i = 1, #langpacks_package_list do
-- dependency list for langpacks-fonts-<lang>
local extra_deps = {}
local lang = langpacks_package_list[i]["lang"]
- rpm.define("langcode " .. lang .. "\n")
- local orth = rpm.expand("%(python3 %{SOURCE4} %{langcode})")
- rpm.undefine("langcode")
+ -- The Python one-liner is expanded to include argtypes and handle potential NULL (None) returns safely
+ local py_cmd = string.format([[python3 -c "import ctypes, sys; fc = ctypes.CDLL('libfontconfig.so.1'); fc.FcLangNormalize.argtypes = [ctypes.c_char_p]; fc.FcLangNormalize.restype = ctypes.c_char_p; res = fc.FcLangNormalize(sys.argv[1].encode('utf-8')); print(res.decode('utf-8') if res else '')" '%s' 2>&1]], lang)
+
+ local fp = io.popen(py_cmd)
+ local orth = fp:read("*a")
+ fp:close()
+
+ -- Strip the trailing newline that Python's print() adds
+ if orth then
+ orth = orth:gsub("%s+$", "")
+ end
local lowerorth = string.lower(orth)
local normlang = string.gsub(string.lower(lang), "_", "-")
local langname = langpacks_package_list[i]["langname"]
diff --git a/normlang.py b/normlang.py
deleted file mode 100644
index 38de6ce..0000000
--- a/normlang.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import ctypes
-import sys
-
-fontconfig = ctypes.CDLL("libfontconfig.so.1")
-fontconfig.FcLangNormalize.argtypes = [ctypes.c_char_p]
-fontconfig.FcLangNormalize.restype = ctypes.c_char_p
-print(fontconfig.FcLangNormalize(sys.argv[1].encode('utf-8')).decode('utf-8'))
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-06 3:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 3:46 [rpms/langpacks] rawhide: Embed python script to avoid an error on rpmautospec Akira TAGOH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox