diff --git a/.gitignore b/.gitignore index ed145d7..d1e5ba5 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /dict.utf8-20131214.tar.bz2 /lm_sc.3gm.arpa-20140820.tar.bz2 /sunpinyin-20160301.tar.xz +/sunpinyin-20190805.tar.xz diff --git a/sources b/sources index 99210dc..bbf146a 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -2055f50a0f942b49d4417d801388eba5 dict.utf8-20131214.tar.bz2 -20cdc36b3bd7ec28f7e39c2ebb810421 lm_sc.3gm.arpa-20140820.tar.bz2 -4f45c504c7e9ea2af28eb604a4dea033 sunpinyin-20160301.tar.xz +SHA512 (sunpinyin-20190805.tar.xz) = 96105d35d6ba6dee48b46a9ea390809e80cb167983772606099f7bbb37a9cbc7aec1de503c655ab00f8618aebfc7cc8d71e915598de97c98e425eb42c73c60b5 +SHA512 (dict.utf8-20131214.tar.bz2) = adaf52a27c6afdeb950912845f3fcb7a6799f997d50a2892ceecf76ed13e3644407338d734832c2ce4b09bce11fec4731774f1eb2dd4c30bea5490555915bd5b +SHA512 (lm_sc.3gm.arpa-20140820.tar.bz2) = ea3ede62eb993c4d21ca7cf339635f4686493a0cefd57df4a31f00a001e67502a13ff9612ff667b941b82b47de00be9f3c9689677d04195a7ef8716bac087519 diff --git a/sunpinyin-fixes-scons.patch b/sunpinyin-fixes-scons.patch new file mode 100644 index 0000000..411ec3c --- /dev/null +++ b/sunpinyin-fixes-scons.patch @@ -0,0 +1,34 @@ +Index: sunpinyin-20190805/SConstruct +=================================================================== +--- sunpinyin-20190805.orig/SConstruct ++++ sunpinyin-20190805/SConstruct +@@ -2,6 +2,7 @@ import platform + import os + import sys + ++from functools import reduce + + version = "2.0.4" + abi_major = 3 +@@ -227,7 +228,7 @@ def CreateEnvironment(): + def PassVariables(envvar, env): + for (x, y) in envvar: + if x in os.environ: +- print 'Warning: you\'ve set %s in the environmental variable!' % x ++ print ('Warning: you\'ve set %s in the environmental variable!' % x) + env[y] = os.environ[x] + + env = CreateEnvironment() +Index: sunpinyin-20190805/src/SConscript +=================================================================== +--- sunpinyin-20190805.orig/src/SConscript ++++ sunpinyin-20190805/src/SConscript +@@ -53,7 +53,7 @@ env.Substfile('sunpinyin-dictgen.mk.in', + }) + env.Command('sunpinyin-dictgen', 'sunpinyin-dictgen.mk', [ + Copy("$TARGET", "$SOURCE"), +- Chmod("$TARGET", 0755), ++ Chmod("$TARGET", "0755"), + ]) + + # -*- indent-tabs-mode: nil -*- vim:et:ts=4 diff --git a/sunpinyin-use-python3.patch b/sunpinyin-use-python3.patch new file mode 100644 index 0000000..aaf55a4 --- /dev/null +++ b/sunpinyin-use-python3.patch @@ -0,0 +1,171 @@ +commit d0693ba9f2686ffa46328da129ffef345258fa12 +Author: Peng Wu +Date: Thu Jul 26 15:08:41 2018 +0800 + + Use python3 + +Index: sunpinyin-20190805/SConstruct +=================================================================== +--- sunpinyin-20190805.orig/SConstruct ++++ sunpinyin-20190805/SConstruct +@@ -299,11 +299,11 @@ def CheckPKG(context, name): + + def CheckPython(context): + context.Message('Checking for Python library...') +- ret = context.TryAction('python-config --prefix')[0] ++ ret = context.TryAction('python3-config --prefix')[0] + context.Result(ret) + if ret: +- context.env.MergeFlags(['!python-config --includes', +- '!python-config --libs']) ++ context.env.MergeFlags(['!python3-config --includes', ++ '!python3-config --libs']) + return ret + + +Index: sunpinyin-20190805/python/pinyin_info_gen.py +=================================================================== +--- sunpinyin-20190805.orig/python/pinyin_info_gen.py ++++ sunpinyin-20190805/python/pinyin_info_gen.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + # +@@ -38,60 +38,60 @@ + from pinyin_data import * + + def fmt_str_array (name, var) : +- print 'static const char *%s[] = { %s };' % (name, ', '.join ('"%s"' % s for s in var)) ++ print('static const char *%s[] = { %s };' % (name, ', '.join ('"%s"' % s for s in var))) + + def fmt_array_size (name): +- print 'static const unsigned num_%s = sizeof(%s) / sizeof(*%s);' % (name, name, name) ++ print('static const unsigned num_%s = sizeof(%s) / sizeof(*%s);' % (name, name, name)) + + def fmt_str_pair_array (name, var) : +- print 'static const char *%s[] = {' % name ++ print('static const char *%s[] = {' % name) + for s1, s2 in var: +- print ' %-7s %s' % ('"%s",' % s1, '"%s",' % s2) +- print '};' ++ print(' %-7s %s' % ('"%s",' % s1, '"%s",' % s2)) ++ print('};') + + def fmt_pair_array_size (name): +- print 'static const unsigned num_%s = sizeof(%s) / sizeof(*%s) / 2;' % (name, name, name) ++ print('static const unsigned num_%s = sizeof(%s) / sizeof(*%s) / 2;' % (name, name, name)) + + fmt_str_array ('initials', initials) + fmt_array_size ('initials') +-print '' ++print('') + + fmt_str_array('finals', finals) + fmt_array_size ('finals') +-print '' ++print('') + + fmt_str_array('fuzzy_finals', inner_fuzzy_finals) + fmt_array_size ('fuzzy_finals') +-print '' ++print('') + + fmt_str_pair_array ('fuzzy_pairs', fuzzy_pairs) + fmt_pair_array_size ('fuzzy_pairs') +-print '' ++print('') + + fmt_str_pair_array ('auto_correction_pairs', sorted(auto_correction_pairs.items())) + fmt_pair_array_size ('auto_correction_pairs') +-print '' ++print('') + +-print 'static const unsigned fuzzy_finals_map [] = {' ++print('static const unsigned fuzzy_finals_map [] = {') + for s in inner_fuzzy_finals: +- print ' %-7s %-7s %-7s /* %-4s -> %-4s len %d */' % ('0x%02x,' % finals.index(s), '0x%02x,' % valid_syllables[s[1:]], '%d,' % (len(s)-1,), s, s[1:], len(s)-1) +-print '};\n' ++ print(' %-7s %-7s %-7s /* %-4s -> %-4s len %d */' % ('0x%02x,' % finals.index(s), '0x%02x,' % valid_syllables[s[1:]], '%d,' % (len(s)-1,), s, s[1:], len(s)-1)) ++print('};\n') + +-print 'static const TPyTabEntry pinyin_table[] = {' ++print('static const TPyTabEntry pinyin_table[] = {') + for syllable, hex_syllable in sorted(valid_syllables.items()): +- print ' { %-9s %s },' % ('"%s",' % syllable, '0x%05x' % hex_syllable) +-print '};\n' ++ print(' { %-9s %s },' % ('"%s",' % syllable, '0x%05x' % hex_syllable)) ++print('};\n') + +-print 'static const unsigned fuzzy_pre_syllables [] = {' ++print('static const unsigned fuzzy_pre_syllables [] = {') + for s in fuzzy_pre_syllables: +- print ' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s[:-1]], "'%s'," % s[-1], '0x%05x,' % valid_syllables[s], s) +-print ' 0x0,' +-print '};\n' ++ print(' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s[:-1]], "'%s'," % s[-1], '0x%05x,' % valid_syllables[s], s)) ++print(' 0x0,') ++print('};\n') + +-print 'static const unsigned fuzzy_pro_syllables [] = {' ++print('static const unsigned fuzzy_pro_syllables [] = {') + for s in fuzzy_pro_syllables: +- print ' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s], "'%s'," % s[0], '0x%05x,' % valid_syllables[s[1:]], s) +-print ' 0x0,' +-print '};\n' ++ print(' %-11s %-7s %-11s /* %s */' % ('0x%05x,' % valid_syllables[s], "'%s'," % s[0], '0x%05x,' % valid_syllables[s[1:]], s)) ++print(' 0x0,') ++print('};\n') + + # -*- indent-tabs-mode: nil -*- vim:et:ts=4 +Index: sunpinyin-20190805/python/quanpin_trie_gen.py +=================================================================== +--- sunpinyin-20190805.orig/python/quanpin_trie_gen.py ++++ sunpinyin-20190805/python/quanpin_trie_gen.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + # +@@ -42,7 +42,7 @@ import sys + orig_trie = trie.Trie () + pytrie = trie.DATrie () + +-for syllable, hex_syllable in pinyin_data.valid_syllables.items(): ++for syllable, hex_syllable in list(pinyin_data.valid_syllables.items()): + orig_trie.add(syllable[::-1], hex_syllable) + + pytrie.construct_from_trie (orig_trie) +Index: sunpinyin-20190805/python/trie.py +=================================================================== +--- sunpinyin-20190805.orig/python/trie.py ++++ sunpinyin-20190805/python/trie.py +@@ -133,7 +133,7 @@ class DATrie (object): + + trie = Trie() + for w in words: +- trie.add (w, itval.next() if itval else -1) ++ trie.add (w, next(itval) if itval else -1) + + self.construct_from_trie (trie, values!=None) + +@@ -161,7 +161,7 @@ class DATrie (object): + if progress_cb: + progress_cb () + +- for i in xrange (self.chr_encoder (max(trie.root.trans))+1): ++ for i in range (self.chr_encoder (max(trie.root.trans))+1): + if self.check[i] == -1: + self.check[i] = 0 + +@@ -272,7 +272,7 @@ def test (): + v, l = match_longest (datrie, s+'b') + assert (len(s) == l and valid_syllables[s] == v) + +- print 'test executed successfully' ++ print('test executed successfully') + + if __name__ == "__main__": + test () diff --git a/sunpinyin.spec b/sunpinyin.spec index 44e4c6b..261e0e3 100644 --- a/sunpinyin.spec +++ b/sunpinyin.spec @@ -1,21 +1,27 @@ +# TODO: fixes scons to generate debug information +%global debug_package %{nil} + %define _xinputconf %{_sysconfdir}/X11/xinit/xinput.d/xsunpinyin.conf -%define gitdate 20160301 +%define gitdate 20190805 Name: sunpinyin -Version: 2.0.4 +Version: 3.0.0 Release: 0.17.%{gitdate}git%{?dist} Summary: A statistical language model based Chinese input method engine -Group: System Environment/Libraries -License: LGPLv2 or CDDL +License: LGPL-2.1-only OR CDDL-1.0 URL: http://code.google.com/p/sunpinyin/ Source0: %{name}-%{gitdate}.tar.xz Source2: http://downloads.sourceforge.net/project/open-gram/lm_sc.3gm.arpa-20140820.tar.bz2 Source3: http://downloads.sourceforge.net/project/open-gram/dict.utf8-20131214.tar.bz2 +Patch0: sunpinyin-use-python3.patch +Patch1: sunpinyin-fixes-scons.patch +BuildRequires: make +BuildRequires: gcc-c++ BuildRequires: sqlite-devel BuildRequires: gettext -BuildRequires: scons +BuildRequires: python3-scons BuildRequires: perl(Pod::Man) -BuildRequires: python-devel +BuildRequires: python3-devel %description Sunpinyin is an input method engine for Simplified Chinese. It is an SLM based @@ -26,7 +32,6 @@ systems. The 2.0 release currently supports iBus, XIM, and Mac OS X. %package devel Summary: Development files for %{name} -Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel @@ -35,8 +40,7 @@ to write their own front-end for sunpinyin. %package data Summary: Little-endian data files for %{name} -Group: System Environment/Libraries -License: CC-BY-SA +License: CC-BY-SA-3.0 Obsoletes: %{name}-data-le Obsoletes: %{name}-data-be @@ -45,7 +49,8 @@ The %{name}-data package contains necessary lexicon data and its index data files needed by the sunpinyin input methods. %prep -%setup -q -n %{name}-%{gitdate} +%autosetup -p1 -n %{name}-%{gitdate} + mkdir -p raw cp %SOURCE2 raw cp %SOURCE3 raw @@ -76,10 +81,6 @@ popd install -m0644 AUTHORS TODO %{buildroot}%{_docdir}/%{name} -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - %files %license COPYING *.LICENSE %{_libdir}/libsunpinyin*.so.* @@ -99,6 +100,86 @@ install -m0644 AUTHORS TODO %{buildroot}%{_docdir}/%{name} %{_docdir}/%{name}/SLM-*.mk %changelog +* Fri Jul 17 2026 Fedora Release Engineering - 3.0.0-0.17.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild + +* Sat Jan 17 2026 Fedora Release Engineering - 3.0.0-0.16.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + +* Fri Jul 25 2025 Fedora Release Engineering - 3.0.0-0.15.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Sun Jan 19 2025 Fedora Release Engineering - 3.0.0-0.14.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Sat Jul 20 2024 Fedora Release Engineering - 3.0.0-0.13.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Sat Jan 27 2024 Fedora Release Engineering - 3.0.0-0.12.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 3.0.0-0.11.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Apr 28 2023 Peng Wu - 3.0.0-0.10.20190805git +- Migrate to SPDX license + +* Sat Jan 21 2023 Fedora Release Engineering - 3.0.0-0.9.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 3.0.0-0.8.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sat Jan 22 2022 Fedora Release Engineering - 3.0.0-0.7.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 3.0.0-0.6.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jan 27 2021 Fedora Release Engineering - 3.0.0-0.5.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Aug 01 2020 Fedora Release Engineering - 3.0.0-0.4.20190805git +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 3.0.0-0.3.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jan 31 2020 Fedora Release Engineering - 3.0.0-0.2.20190805git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Aug 5 2019 Peng Wu - 3.0.0-0.1.20190805git +- Update scons and use python3 + +* Sat Jul 27 2019 Fedora Release Engineering - 2.0.4-0.26.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sun Feb 03 2019 Fedora Release Engineering - 2.0.4-0.25.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 26 2018 Peng Wu - 2.0.4-0.24.20160301git%{?dist} +- Use python2 + +* Sat Jul 14 2018 Fedora Release Engineering - 2.0.4-0.23.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Sun Mar 18 2018 Iryna Shcherbina - 2.0.4-0.22.20160301git +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 2.0.4-0.21.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 2.0.4-0.20.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.0.4-0.19.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 2.0.4-0.18.20160301git +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Tue Mar 1 2016 Peng Wu - 2.0.4-0.17.20160301git - Update to the latest upstream git snapshot