public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/langpacks] rawhide: Revert "Embed python script to avoid an error on rpmautospec"
@ 2026-10-06 16:00 Parag Nemade
  0 siblings, 0 replies; only message in thread
From: Parag Nemade @ 2026-10-06 16:00 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/langpacks
            Branch : rawhide
            Commit : 096580f772662921f70c52f3c5bf617d73538d97
            Author : Parag Nemade <panemade AT redhat DOT com>
            Date   : 2026-10-06T21:14:37+05:30
            Stats  : +11/-11 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/langpacks/c/096580f772662921f70c52f3c5bf617d73538d97?branch=rawhide

            Log:
            Revert "Embed python script to avoid an error on rpmautospec"

This reverts commit 56eddfced77e2b7a097d12a2ba6dc49191af3ad0.

---
diff --git a/langpacks.spec b/langpacks.spec
index 827bca9..ad03f14 100644
--- a/langpacks.spec
+++ b/langpacks.spec
@@ -6,6 +6,7 @@ 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,17 +1557,9 @@ for i = 1, #langpacks_package_list do
   -- dependency list for langpacks-fonts-<lang>
   local extra_deps = {}
   local lang = langpacks_package_list[i]["lang"]
-  -- 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
+  rpm.define("langcode " .. lang .. "\n")
+  local orth = rpm.expand("%(python3 %{SOURCE4} %{langcode})")
+  rpm.undefine("langcode")
   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
new file mode 100644
index 0000000..38de6ce
--- /dev/null
+++ b/normlang.py
@@ -0,0 +1,7 @@
+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 16:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 16:00 [rpms/langpacks] rawhide: Revert "Embed python script to avoid an error on rpmautospec" Parag Nemade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox