[skf/f14/master] * Thu Aug 12 2010 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1.97.2-1 - 1.97.2 - The method to bu

Mamoru Tasaka mtasaka at fedoraproject.org
Wed Aug 11 21:33:51 UTC 2010


commit 2ced8f8a245680a23f847acdb34eadb783764b2f
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date:   Thu Aug 12 06:33:47 2010 +0900

    * Thu Aug 12 2010 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1.97.2-1
    - 1.97.2
    - The method to build python3 binding is now written in the spec file,
      however for now not activate it

 .gitignore        |    1 +
 skf-basic-test.sh |   67 +++++++++++++++++++++++++++++++++++++++
 skf.spec          |   91 ++++++++++++++++++++++++++++++++++++++++++++++++----
 sources           |    2 +-
 4 files changed, 153 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 79ccbf2..f960ed7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 skf_1.97.1.tar.gz
+skf_1.97.2.tar.gz
diff --git a/skf-basic-test.sh b/skf-basic-test.sh
new file mode 100644
index 0000000..5ad5336
--- /dev/null
+++ b/skf-basic-test.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+set -x
+
+a_utf8=$(echo -e '\xe3\x81\x82')
+a_eucjp=$(echo -e '\xa4\xa2')
+
+# Binary
+echo "Checking Binary"
+a_from_shift_jis=$(echo $a_eucjp | skf -s | iconv -f shift-jis -t utf-8)
+a_from_iso=$(echo $a_eucjp | skf --oc=iso-2022-jp | iconv -f iso-2022-jp -t utf-8)
+a_from_utf8=$(echo $a_eucjp | skf -z)
+
+if [ "$a_from_shift_jis" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_iso" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_utf8" != "$a_utf8" ] ; then exit 1 ; fi
+
+echo "Checking python2"
+export PYTHONPATH=$python2PATH
+a_from_shift_jis=$(python2 -c "import skf ; print (skf.convert('-s', \"$a_eucjp\"))" | iconv -f shift-jis -t utf-8)
+a_from_iso=$(python2 -c "import skf ; print (skf.convert('--oc=iso-2022-jp', \"$a_eucjp\"))" | iconv -f iso-2022-jp -t utf-8)
+a_from_utf8=$(python2 -c "import skf ; print (skf.convert('-z', \"$a_eucjp\"))")
+
+if [ "$a_from_shift_jis" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_iso" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_utf8" != "$a_utf8" ] ; then exit 1 ; fi
+
+# python3
+# skip this for now
+if ( which python3 && false ) ; then
+   # Not check for now
+   echo "Checking python3"
+   export PYTHONPATH=$python3PATH
+   #FIXME
+   #FIXME
+   #The following 3 lines need fixing
+   a_from_shift_jis=$(python3 -c "import skf ; print (skf.convert('-s', \"$a_eucjp\"))" | iconv -f shift-jis -t utf-8)
+   a_from_iso=$(python3 -c "import skf ; print (skf.convert('--oc=iso-2022-jp', \"$a_eucjp\"))" | iconv -f iso-2022-jp -t utf-8)
+   a_from_utf8=$(python3 -c "import skf ; print (skf.convert('-z', \"$a_eucjp\"))")
+
+   if [ "$a_from_shift_jis" != "$a_utf8" ] ; then exit 1 ; fi
+   if [ "$a_from_iso" != "$a_utf8" ] ; then exit 1 ; fi
+   if [ "$a_from_utf8" != "$a_utf8" ] ; then exit 1 ; fi
+fi
+
+# perl
+echo "Checking perl"
+a_from_shift_jis=$(perl -e "use Skf ; print Skf::convert('-s', \"$a_eucjp\")" | iconv -f shift-jis -t utf-8)
+a_from_iso=$(perl -e "use Skf ; print Skf::convert('--oc=iso-2022-jp', \"$a_eucjp\")" | iconv -f iso-2022-jp -t utf-8)
+a_from_utf8=$(perl -e "use Skf ; print Skf::convert('-z', \"$a_eucjp\")")
+
+if [ "$a_from_shift_jis" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_iso" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_utf8" != "$a_utf8" ] ; then exit 1 ; fi
+
+
+# ruby
+echo "Checking ruby"
+ruby -e 'puts $:'
+
+a_from_shift_jis=$(ruby -e "require 'skf' ; puts Skf.convert('-s', \"$a_eucjp\")" | iconv -f shift-jis -t utf-8)
+a_from_iso=$(ruby -e "require 'skf' ; puts Skf.convert('--oc=iso-2022-jp', \"$a_eucjp\")" | iconv -f iso-2022-jp -t utf-8)
+a_from_utf8=$(ruby -e "require 'skf' ; puts Skf.convert('-z', \"$a_eucjp\")")
+
+if [ "$a_from_shift_jis" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_iso" != "$a_utf8" ] ; then exit 1 ; fi
+if [ "$a_from_utf8" != "$a_utf8" ] ; then exit 1 ; fi
diff --git a/skf.spec b/skf.spec
index 8ad878e..5c36d65 100644
--- a/skf.spec
+++ b/skf.spec
@@ -3,22 +3,30 @@
 
 %{!?python_sitearch:	%global	python_sitearch	%(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
-%global	repoid		46744
+%global	repoid		48535
 
-%global	mainver	1.97.1
+%global	mainver	1.97.2
 #%%global	betaver	a
 
-%global	fedoraver	2
+%global	fedoraver	1
+
+%global	enable_python3	0
+%if 0%{?fedora} >= 13
+# Disable python3 support for now, how to handle NON-utf8 string
+# in python3 with skf...
+%global	enable_python3	0
+%endif
 
 Name:		skf
 Version:	%{mainver}
-Release:	%{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist}.2
+Release:	%{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist}
 Summary:	Utility binary files in Simple Kanji Filter
 
 Group:		Applications/Text
 License:	BSD and MIT and UCD
 URL:		http://sourceforge.jp/projects/skf/
 Source0:	http://dl.sourceforge.jp/skf/%{repoid}/skf_%{mainver}%{?betaver}.tar.gz
+Source1:	skf-basic-test.sh
 
 # common BR
 BuildRequires:	gettext
@@ -29,6 +37,9 @@ BuildRequires:	ruby-devel
 BuildRequires:	ruby(abi) = %{rubyabi}
 BuildRequires:	perl(ExtUtils::Embed)
 BuildRequires:	python2-devel
+%if %enable_python3
+BuildRequires:	python3-devel
+%endif
 
 Requires:	%{name}-common = %{version}-%{release}
 
@@ -48,6 +59,13 @@ Summary:	Python extension module for %{name}
 Group:		Development/Languages
 Requires:	%{name}-common = %{version}-%{release}
 
+%if %enable_python3
+%package	python3
+Summary:	Python3 extension module for %{name}
+Group:		Development/Languages
+Requires:	%{name}-common = %{version}-%{release}
+%endif
+
 %package	perl
 Summary:	Perl extension module for %{name}
 Group:		Development/Languages
@@ -80,6 +98,11 @@ This package contains Ruby extension module for skf.
 %description	python
 This package contains Python extension module for skf.
 
+%if %enable_python3
+%description	python3
+This package contains Python3 extension module for skf.
+%endif
+
 %description	perl
 This package contains Perl extension module for skf.
 
@@ -87,10 +110,12 @@ This package contains Perl extension module for skf.
 %setup -q -c -T -a 0
 ln -sf %{name}-* main
 
+cp -p %SOURCE1 .
+
 pushd main
 
 ## Fixing build error
-# Fix pythonext build error on F-11
+# Fix pythonext build error on F-14+
 sed -i -e '/python_version=.*substr/s|7,-3|7,3|' configure
 
 ## configure option, etc
@@ -112,6 +137,9 @@ popd # from main
 
 # Okay, duplicate main directory
 for ext in \
+%if %enable_python3
+	python3 \
+%endif
 	ruby perl python
 do
 	mkdir -p $ext
@@ -129,8 +157,12 @@ done
 OPTS=""
 OPTS="$OPTS --enable-debug"
 OPTS="$OPTS --disable-strip"
+
 OPTS="$OPTS --with-ruby_sitearch_dir=%{ruby_sitearch}"
-OPTS="$OPTS --with-python_sitearch_dir=%{python_sitearch}"
+PYTHONOPTS="$OPTS --with-python_sitearch_dir=%{python_sitearch}"
+%if %enable_python3
+PYTHON3OPTS="$OPTS --enable-python3 --with-python_sitearch_dir=%{python3_sitearch}"
+%endif
 
 # A. main
 pushd main
@@ -143,12 +175,24 @@ for ext in \
 	ruby perl python
 do
 	pushd $ext
-	%configure $OPTS
+	%configure $OPTS $PYTHONOPTS
 	unset CFLAGS
 	make -j1 ${ext}ext
 	popd
 done
 
+# python3
+%if %enable_python3
+pushd python3
+export PYTHON=python3
+%configure $OPTS $PYTHON3OPTS
+unset CFLAGS
+# The following is pythonext, not python3ext
+make -j1 pythonext
+unset PYTHON
+popd
+%endif
+
 # tweak find-debuginfo.sh
 %global	__debug_install_post_old	%__debug_install_post
 %global	__debug_install_post		\
@@ -156,8 +200,10 @@ done
 	%__debug_install_post_old \
 	pushd %{buildroot}%{_prefix}/src/debug/%{?buildsubdir} \
 	for ext in \\\
+		python3 \\\
 		ruby python perl \
 	do \
+		test -d $ext || continue \
 		cd $ext \
 		for file in * \
 		do \
@@ -195,6 +241,11 @@ for ext in ruby python
 do
 	eval make -C $ext ${OPTS} ${ext}ext_install
 done
+## python3
+%if %enable_python3
+( eval make -C python3 ${OPTS} pythonext_install )
+%endif
+
 ## perl
 pushd perl
 mkdir -p %{buildroot}%{perl_vendorarch}/auto/Skf
@@ -207,6 +258,20 @@ chmod 0644 %{buildroot}%{python_sitearch}/skf.py
 
 %find_lang %{name}
 
+%check
+# Setting environ
+export PATH=%{buildroot}%{_bindir}:$PATH
+
+export PERL5LIB=%{buildroot}%{perl_vendorarch}
+export python2PATH=%{buildroot}%{python_sitearch}
+%if %enable_python3
+export python3PATH=%{buildroot}%{python3_sitearch}
+%endif
+export RUBYLIB=%{buildroot}%{ruby_sitearch}
+
+# SOURCE1
+sh skf-basic-test.sh
+
 %clean
 rm -rf %{buildroot}
 
@@ -235,12 +300,24 @@ rm -rf %{buildroot}
 %{python_sitearch}/_skf.so
 %{python_sitearch}/skf.py*
 
+%if %enable_python3
+%files	python3
+%defattr(-,root,root,-)
+%{python3_sitearch}/_skf.so
+%{python3_sitearch}/skf.py*
+%endif
+
 %files	perl
 %defattr(-,root,root,-)
 %{perl_vendorarch}/Skf.pm
 %{perl_vendorarch}/auto/Skf/
 
 %changelog
+* Thu Aug 12 2010 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1.97.2-1
+- 1.97.2
+- The method to build python3 binding is now written in the spec file,
+  however for now not activate it
+
 * Thu Jul 22 2010 David Malcolm <dmalcolm at redhat.com> - 1.97.1-2.2
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 
diff --git a/sources b/sources
index 49c2a09..26cf434 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-f4041ef193e6942b2543006db271910f  skf_1.97.1.tar.gz
+4e3225dc93ac1f8c957759b135c7dd1c  skf_1.97.2.tar.gz


More information about the scm-commits mailing list