public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Akira TAGOH <akira@tagoh.org>
To: git-commits@fedoraproject.org
Subject: [rpms/langpacks] rawhide: Embed python script to avoid an error on rpmautospec
Date: Tue, 06 Oct 2026 03:46:21 GMT	[thread overview]
Message-ID: <179125838106.1.3842139163668178013.rpms-langpacks-56eddfced77e@fedoraproject.org> (raw)

            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'))

                 reply	other threads:[~2026-10-06  3:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179125838106.1.3842139163668178013.rpms-langpacks-56eddfced77e@fedoraproject.org \
    --to=akira@tagoh.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox