Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package systemd-inputmethod-generator for openSUSE:Factory checked in at 2022-02-27 22:43:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/systemd-inputmethod-generator (Old) and /work/SRC/openSUSE:Factory/.systemd-inputmethod-generator.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "systemd-inputmethod-generator" Sun Feb 27 22:43:12 2022 rev:2 rq:957884 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/systemd-inputmethod-generator/systemd-inputmethod-generator.changes 2022-02-24 18:24:06.602648217 +0100 +++ /work/SRC/openSUSE:Factory/.systemd-inputmethod-generator.new.1958/systemd-inputmethod-generator.changes 2022-02-27 22:44:20.170652112 +0100 @@ -1,0 +2,7 @@ +Sun Feb 27 09:27:15 UTC 2022 - Marguerite Su <i...@marguerite.su> + +- update version 1.0.1 + * be aware of user's custom settings, /etc/sysconfig/language + and $LANG + +------------------------------------------------------------------- Old: ---- systemd-inputmethod-generator-1.0.0.tar.gz New: ---- systemd-inputmethod-generator-1.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ systemd-inputmethod-generator.spec ++++++ --- /var/tmp/diff_new_pack.VTFn0Q/_old 2022-02-27 22:44:20.594652235 +0100 +++ /var/tmp/diff_new_pack.VTFn0Q/_new 2022-02-27 22:44:20.598652236 +0100 @@ -17,7 +17,7 @@ Name: systemd-inputmethod-generator -Version: 1.0.0 +Version: 1.0.1 Release: 0 Summary: Expose INPUT_METHOD environment variable License: GPL-3.0-or-later ++++++ systemd-inputmethod-generator-1.0.0.tar.gz -> systemd-inputmethod-generator-1.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/COMMIT_EDITMSG new/systemd-inputmethod-generator-1.0.1/.git/COMMIT_EDITMSG --- old/systemd-inputmethod-generator-1.0.0/.git/COMMIT_EDITMSG 1970-01-01 01:00:00.000000000 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/COMMIT_EDITMSG 2022-02-27 10:26:46.709264721 +0100 @@ -0,0 +1 @@ +be aware of user custom settings, /etc/sysconfig/language, and zh_CN.UTF-8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/FETCH_HEAD new/systemd-inputmethod-generator-1.0.1/.git/FETCH_HEAD --- old/systemd-inputmethod-generator-1.0.0/.git/FETCH_HEAD 1970-01-01 01:00:00.000000000 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/FETCH_HEAD 2022-02-27 10:26:46.709264721 +0100 @@ -0,0 +1 @@ +aff6d56580804179de8afb503a97fc24b4cfe8e1 branch 'main' of https://github.com/openSUSE-zh/systemd-inputmethod-generator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/ORIG_HEAD new/systemd-inputmethod-generator-1.0.1/.git/ORIG_HEAD --- old/systemd-inputmethod-generator-1.0.0/.git/ORIG_HEAD 1970-01-01 01:00:00.000000000 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/ORIG_HEAD 2022-02-27 10:26:46.709264721 +0100 @@ -0,0 +1 @@ +aff6d56580804179de8afb503a97fc24b4cfe8e1 Binary files old/systemd-inputmethod-generator-1.0.0/.git/index and new/systemd-inputmethod-generator-1.0.1/.git/index differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/logs/HEAD new/systemd-inputmethod-generator-1.0.1/.git/logs/HEAD --- old/systemd-inputmethod-generator-1.0.0/.git/logs/HEAD 2022-02-23 14:25:16.999468500 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/logs/HEAD 2022-02-27 10:26:46.709264721 +0100 @@ -1 +1,2 @@ -0000000000000000000000000000000000000000 599bd1103d6211c275aa90fe3f91ced48652e260 marguerite <i...@marguerite.su> 1645622716 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator +0000000000000000000000000000000000000000 aff6d56580804179de8afb503a97fc24b4cfe8e1 marguerite <i...@marguerite.su> 1645880741 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator +aff6d56580804179de8afb503a97fc24b4cfe8e1 09b3c536765fb692d5b3cc9d92aeba92f6225922 marguerite <i...@marguerite.su> 1645953807 +0800 commit: be aware of user custom settings, /etc/sysconfig/language, and zh_CN.UTF-8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/heads/main new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/heads/main --- old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/heads/main 2022-02-23 14:25:16.999468500 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/heads/main 2022-02-27 10:26:46.709264721 +0100 @@ -1 +1,2 @@ -0000000000000000000000000000000000000000 599bd1103d6211c275aa90fe3f91ced48652e260 marguerite <i...@marguerite.su> 1645622716 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator +0000000000000000000000000000000000000000 aff6d56580804179de8afb503a97fc24b4cfe8e1 marguerite <i...@marguerite.su> 1645880741 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator +aff6d56580804179de8afb503a97fc24b4cfe8e1 09b3c536765fb692d5b3cc9d92aeba92f6225922 marguerite <i...@marguerite.su> 1645953807 +0800 commit: be aware of user custom settings, /etc/sysconfig/language, and zh_CN.UTF-8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/remotes/origin/HEAD new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/remotes/origin/HEAD --- old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/remotes/origin/HEAD 2022-02-23 14:25:16.999468500 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/remotes/origin/HEAD 2022-02-27 10:26:46.709264721 +0100 @@ -1 +1 @@ -0000000000000000000000000000000000000000 599bd1103d6211c275aa90fe3f91ced48652e260 marguerite <i...@marguerite.su> 1645622716 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator +0000000000000000000000000000000000000000 aff6d56580804179de8afb503a97fc24b4cfe8e1 marguerite <i...@marguerite.su> 1645880741 +0800 clone: from https://github.com/openSUSE-zh/systemd-inputmethod-generator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/remotes/origin/main new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/remotes/origin/main --- old/systemd-inputmethod-generator-1.0.0/.git/logs/refs/remotes/origin/main 1970-01-01 01:00:00.000000000 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/logs/refs/remotes/origin/main 2022-02-27 10:26:46.709264721 +0100 @@ -0,0 +1 @@ +aff6d56580804179de8afb503a97fc24b4cfe8e1 09b3c536765fb692d5b3cc9d92aeba92f6225922 marguerite <i...@marguerite.su> 1645953829 +0800 update by push Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/09/b3c536765fb692d5b3cc9d92aeba92f6225922 and new/systemd-inputmethod-generator-1.0.1/.git/objects/09/b3c536765fb692d5b3cc9d92aeba92f6225922 differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/70/2b8e54cbe5bbab99a9c77829a63901cfa73b33 and new/systemd-inputmethod-generator-1.0.1/.git/objects/70/2b8e54cbe5bbab99a9c77829a63901cfa73b33 differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/83/7078792955eb9c8861aab23f8e25be684712c5 and new/systemd-inputmethod-generator-1.0.1/.git/objects/83/7078792955eb9c8861aab23f8e25be684712c5 differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/95/301292816c0bed0d01bc425f7e5ceca26d5b9c and new/systemd-inputmethod-generator-1.0.1/.git/objects/95/301292816c0bed0d01bc425f7e5ceca26d5b9c differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/pack/pack-f429924beab2e87059ff6fc5c2235c232af4b5ae.idx and new/systemd-inputmethod-generator-1.0.1/.git/objects/pack/pack-f429924beab2e87059ff6fc5c2235c232af4b5ae.idx differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/pack/pack-f429924beab2e87059ff6fc5c2235c232af4b5ae.pack and new/systemd-inputmethod-generator-1.0.1/.git/objects/pack/pack-f429924beab2e87059ff6fc5c2235c232af4b5ae.pack differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/pack/pack-f50ac6c6dece054b7136a878eaf88871bac965f2.idx and new/systemd-inputmethod-generator-1.0.1/.git/objects/pack/pack-f50ac6c6dece054b7136a878eaf88871bac965f2.idx differ Binary files old/systemd-inputmethod-generator-1.0.0/.git/objects/pack/pack-f50ac6c6dece054b7136a878eaf88871bac965f2.pack and new/systemd-inputmethod-generator-1.0.1/.git/objects/pack/pack-f50ac6c6dece054b7136a878eaf88871bac965f2.pack differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/packed-refs new/systemd-inputmethod-generator-1.0.1/.git/packed-refs --- old/systemd-inputmethod-generator-1.0.0/.git/packed-refs 2022-02-23 14:25:16.999468500 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/packed-refs 2022-02-27 10:26:46.709264721 +0100 @@ -1,2 +1,2 @@ # pack-refs with: peeled fully-peeled sorted -599bd1103d6211c275aa90fe3f91ced48652e260 refs/remotes/origin/main +aff6d56580804179de8afb503a97fc24b4cfe8e1 refs/remotes/origin/main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/refs/heads/main new/systemd-inputmethod-generator-1.0.1/.git/refs/heads/main --- old/systemd-inputmethod-generator-1.0.0/.git/refs/heads/main 2022-02-23 14:25:16.999468500 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/refs/heads/main 2022-02-27 10:26:46.709264721 +0100 @@ -1 +1 @@ -599bd1103d6211c275aa90fe3f91ced48652e260 +09b3c536765fb692d5b3cc9d92aeba92f6225922 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/.git/refs/remotes/origin/main new/systemd-inputmethod-generator-1.0.1/.git/refs/remotes/origin/main --- old/systemd-inputmethod-generator-1.0.0/.git/refs/remotes/origin/main 1970-01-01 01:00:00.000000000 +0100 +++ new/systemd-inputmethod-generator-1.0.1/.git/refs/remotes/origin/main 2022-02-27 10:26:46.709264721 +0100 @@ -0,0 +1 @@ +09b3c536765fb692d5b3cc9d92aeba92f6225922 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/README.md new/systemd-inputmethod-generator-1.0.1/README.md --- old/systemd-inputmethod-generator-1.0.0/README.md 2022-02-23 14:25:17.003468468 +0100 +++ new/systemd-inputmethod-generator-1.0.1/README.md 2022-02-27 10:26:46.701264816 +0100 @@ -1,5 +1,9 @@ inputmethod-environment-generator --- +--- -This project exposes INPUT_METHOD environment variable to user sessions according to the priority settings in /etc/X11/xim.d, so wayland sessions can use the input method we specify and systemd fcitx/ibus user services can work. +This project exposes `INPUT_METHOD` environment variable to user sessions according to these priorities: + +1. the `INPUT_METHOD` value or the XXX in 'export XMODIFIERS="@im=XXX"' in `~/.xim`, `~/.i18n`, `~/.profile`, `~/.login`. +2. the `INPUT_METHOD` value in /etc/sysconfig/language. +3. the smallest name in `/etc/X11/xim.d/$LANG` or `/usr/etc/X11/xim.d/$LANG`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-inputmethod-generator-1.0.0/inputmethod.py3 new/systemd-inputmethod-generator-1.0.1/inputmethod.py3 --- old/systemd-inputmethod-generator-1.0.0/inputmethod.py3 2022-02-23 14:25:17.003468468 +0100 +++ new/systemd-inputmethod-generator-1.0.1/inputmethod.py3 2022-02-27 10:26:46.701264816 +0100 @@ -1,37 +1,84 @@ #!/usr/bin/python3 -from os import listdir +from os import environ, listdir from os.path import isdir, isfile, join +from re import search -def get_input_methods(): - mypath = "/etc/X11/xim.d/en" - files = [] - if isdir(mypath): - files = [f for f in listdir(mypath) if isfile(join(mypath, f))] - if not files: - mypath = "/usr/etc/X11/xim.d/en" - if isdir(mypath): - files = [f for f in listdir(mypath) if isfile(join(mypath, f))] - return files +def input_method_exist(im): + if not im: + return False + system_paths = ["/etc/X11/xim.d", "/usr/etc/X11/xim.d"] + for path in system_paths: + path = join(path, im) + if isfile(path): + return True + return False def get_current_input_method(): + system_paths = ["/etc/X11/xim.d", "/usr/etc/X11/xim.d"] + pattern = '^export\s+(INPUT_METHOD|XMODIFIERS)=("@im=)?([A-Za-z0-9]+)(")?$' + pattern_sysconfig = '^INPUT_METHOD="([A-Za-z0-9]+)"$' + input_method = "" + + # find input_method in $HOME/.xim or $HOME/.i18n + for conf in [".xim", ".i18n", ".profile", ".login"]: + conf = join(environ.get("HOME"), conf) + if isfile(conf): + file = open(conf, "r") + + for line in file: + find = search(pattern, line) + if find: + input_method = find.group(3) + break + + file.close() + if input_method: + break + + # use user-specified INPUT_METHOD + if input_method_exist(input_method): + print("INPUT_METHOD={}".format(input_method.lower())) + exit + + # try to use INPUT_METHOD in /etc/sysconfig/language + if isfile("/etc/sysconfig/language"): + file = open("/etc/sysconfig/language", "r") + for line in file: + find = search(pattern_sysconfig, line) + if find: + input_method = find.group(1) + break + file.close() + + if input_method_exist(input_method): + print("INPUT_METHOD={}".format(input_method.lower())) + exit + + # use language default + lang = environ.get("LANG").split(".")[0] # "zh_CN" + inputmethods = [] + for path in ["/etc/X11/xim.d", "/usr/etc/X11/xim.d"]: + path = join(path, lang) + if isdir(path): + inputmethods = [f for f in listdir(path) if isfile(join(path, f))] + if not inputmethods: + # leave INPUT_METHOD unset + exit i = 0 j = 0 - s = "" - m = get_input_methods() - if not m: - return s - for im in m: - arr = im.split('-') + for im in inputmethods: + arr = im.split("-") if j == 0: i = arr[0] - s = arr[1] - j+=1 + input_method = arr[1] + j += 1 continue if int(arr[0]) < i: i = arr[0] - s = arr[1] - j+=1 - return s + input_method = arr[1] + j += 1 + if input_method: + print("INPUT_METHOD={}".format(input_method.lower())) -print("INPUT_METHOD={}".format(get_current_input_method())) +get_current_input_method()