diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2010-04-16 22:36:32 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2010-04-16 22:36:32 +0900 |
commit | b259ba4db902d492d0676e1760f1d129a0c1e4c5 (patch) | |
tree | 525ccfe122cbeabb7b537491deee0e7b3d1914e3 | |
parent | f6c1d1dde7179c26d07f8d7c9558866e6acb1886 (diff) | |
download | ibus-anthy-b259ba4db902d492d0676e1760f1d129a0c1e4c5.tar.gz |
Fix OSError when the link of zipcode.t is broken. #854
-rw-r--r-- | configure.ac | 34 | ||||
-rw-r--r-- | engine/engine.py | 7 | ||||
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | po/POTFILES.skip | 3 | ||||
-rw-r--r-- | setup/Makefile.am | 37 | ||||
-rw-r--r-- | setup/anthyprefs.py.in | 12 |
6 files changed, 74 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index 33fa919..906a000 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# if not 1, append datestamp to the version number. +dnl - if not 1, append datestamp to the version number. m4_define([ibus_released], [0]) m4_define([ibus_major_version], [1]) m4_define([ibus_minor_version], [2]) @@ -37,7 +37,7 @@ AC_GNU_SOURCE AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) -# define PACKAGE_VERSION_* variables +dnl - define PACKAGE_VERSION_* variables AS_VERSION AS_NANO AM_SANITY_CHECK @@ -51,14 +51,14 @@ AC_HEADER_STDC AM_PROG_LIBTOOL IT_PROG_INTLTOOL([0.35.0]) -# For dislpay Date +dnl - For dislpay Date m4_define(ibus_maybe_datedisplay, m4_esyscmd([if test x]ibus_released[ != x1; then date '+%a %b %d %Y' | tr -d '\n\r'; fi])) m4_define([ibus_datedisplay], ibus_maybe_datedisplay) DATE_DISPLAY="ibus_datedisplay" AC_SUBST(DATE_DISPLAY) -# check anthy +dnl - check anthy PKG_CHECK_MODULES(ANTHY, [ anthy ]) @@ -71,18 +71,18 @@ NTH_HALFKANA_CANDIDATE],, AC_MSG_ERROR([Could not find NTH_*_CANDIDATE values in anthy.h]), [[#include <anthy/anthy.h>]]) -# check swig +dnl - check swig AC_PATH_PROG(SWIG, swig) if test x"$SWIG" == x""; then AC_MSG_ERROR([can not find swig]) fi AC_SUBST(SWIG) -# check env +dnl - check env AC_PATH_PROG(ENV, env) AC_SUBST(ENV) -# check python +dnl - check python AM_PATH_PYTHON([2.5]) AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config) @@ -99,7 +99,23 @@ fi AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LIBS) -# define GETTEXT_* variables +dnl - check file path of Anthy zipcode.t +AC_ARG_WITH(anthy-zipcode, + [AC_HELP_STRING([--with-anthy-zipcode=FILE], + [file path of Anty zipcode.t])], + [ANTHY_ZIPCODE_FILE="$withval"], + [ANTHY_ZIPCODE_FILE="$datadir/anthy/zipcode.t"]) +AC_SUBST(ANTHY_ZIPCODE_FILE) + +dnl - check file path of kasumi bin +AC_ARG_WITH(kasumi-exec, + [AC_HELP_STRING([--with-kasumi-exec=FILE], + [file path of kasumi bin])], + [KASUMI_EXEC_FILE="$withval"], + [KASUMI_EXEC_FILE="$bindir/kasumi"]) +AC_SUBST(KASUMI_EXEC_FILE) + +dnl - define GETTEXT_* variables GETTEXT_PACKAGE=ibus-anthy AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only architecture-independent data directory.]) @@ -108,7 +124,7 @@ AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.16.1) -# OUTPUT files +dnl - OUTPUT files AC_CONFIG_FILES([ po/Makefile.in Makefile ibus-anthy.spec diff --git a/engine/engine.py b/engine/engine.py index ab9a406..8498a0d 100644 --- a/engine/engine.py +++ b/engine/engine.py @@ -1415,6 +1415,9 @@ class Engine(ibus.EngineBase): @classmethod def _link_dict_file_with_id(cls, file, id, link_mode): + if not path.exists(file): + print >> sys.stderr, file + " does not exist" + return if id == None: return if link_mode == LINK_DICT_EMBEDDED: @@ -1433,7 +1436,7 @@ class Engine(ibus.EngineBase): os.makedirs(directory, 0700) backup_dir = os.getcwd() os.chdir(directory) - if path.exists(directory + '/' + name): + if path.lexists(directory + '/' + name): if path.islink(directory + '/' + name): print >> sys.stderr, "Removing " + name os.unlink(directory + '/' + name) @@ -1463,7 +1466,7 @@ class Engine(ibus.EngineBase): return backup_dir = os.getcwd() os.chdir(directory) - if path.exists(directory + '/' + name): + if path.lexists(directory + '/' + name): os.unlink(directory + '/' + name) if backup_dir != None: os.chdir(backup_dir) diff --git a/po/POTFILES.in b/po/POTFILES.in index 4c03774..0653797 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,6 +2,6 @@ # Please keep this file in alphabetical order. engine/engine.py engine/factory.py -setup/anthyprefs.py +setup/anthyprefs.py.in setup/main.py setup/setup.glade diff --git a/po/POTFILES.skip b/po/POTFILES.skip new file mode 100644 index 0000000..1aac5e8 --- /dev/null +++ b/po/POTFILES.skip @@ -0,0 +1,3 @@ +# Files with translatable strings to skip. +# Please keep this file in alphabetical order. +setup/anthyprefs.py diff --git a/setup/Makefile.am b/setup/Makefile.am index 5187536..e377e06 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -20,25 +20,56 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +BUILT_SOURCES = anthyprefs.py + +libexec_SCRIPTS = ibus-setup-anthy + setup_anthy_PYTHON = \ - prefs.py \ anthyprefs.py \ main.py \ + prefs.py \ setup.glade \ $(NULL) +setup_anthy_built_files = \ + $(BUILT_SOURCES) \ + $(libexec_SCRIPTS) \ + $(NULL) + +setup_anthy_built_in_files = $(addsuffix .in, $(setup_anthy_built_files)) + setup_anthydir = $(datadir)/ibus-anthy/setup -libexec_SCRIPTS = ibus-setup-anthy +CONFIG_CLEAN_FILES = \ + $(BUILT_SOURCES) \ + $(libexec_SCRIPTS) \ + $(NULL) CLEANFILES = \ + $(BUILT_SOURCES) \ *.pyc \ $(NULL) EXTRA_DIST = \ - ibus-setup-anthy.in \ + $(setup_anthy_built_in_files) \ $(NULL) +anthyprefs.py: anthyprefs.py.in + sed -e "s|\@ANTHY_ZIPCODE_FILE\@|$(ANTHY_ZIPCODE_FILE)|g" \ + -e "s|\@KASUMI_EXEC_FILE\@|$(KASUMI_EXEC_FILE)|g" \ + -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \ + $< > $@ + +# Need a time lag between .py and .py.in files to build .py files +# because *_PYTHON valuables are installed in the tarball. +dist-hook: + @sleep 1; \ + for in_file in $(setup_anthy_built_in_files) ; do \ + if [ -f $(distdir)/$(srcdir)/$$in_file ] ; then \ + touch $(distdir)/$(srcdir)/$$in_file; \ + fi; \ + done; + test: $(ENV) DBUS_DEBUG=true \ LANG=en_US \ diff --git a/setup/anthyprefs.py.in b/setup/anthyprefs.py.in index b3e5aa0..64dd4d7 100644 --- a/setup/anthyprefs.py.in +++ b/setup/anthyprefs.py.in @@ -169,8 +169,8 @@ _config = { 'shortcut_type': 'default', - 'dict_admin_command': ['/usr/bin/kasumi', 'kasumi'], - 'add_word_command': ['/usr/bin/kasumi', 'kasumi', '-a'], + 'dict_admin_command': ['@KASUMI_EXEC_FILE@', 'kasumi'], + 'add_word_command': ['@KASUMI_EXEC_FILE@', 'kasumi', '-a'], }, 'thumb': { @@ -185,11 +185,11 @@ _config = { }, 'dict': { - 'anthy_zipcode': ['/usr/share/anthy/zipcode.t'], - 'ibus_symbol': ['/usr/share/ibus-anthy/dicts/symbol.t'], + 'anthy_zipcode': ['@ANTHY_ZIPCODE_FILE@'], + 'ibus_symbol': ['@pkgdatadir@/dicts/symbol.t'], 'files': [ - '/usr/share/anthy/zipcode.t', - '/usr/share/ibus-anthy/dicts/symbol.t', + '@ANTHY_ZIPCODE_FILE@', + '@pkgdatadir@/dicts/symbol.t', ], }, |