conduit r1737 - in trunk: . conduit/gtkui conduit/modules/iPodModule m4 scripts



Author: jstowers
Date: Sun Oct  5 11:24:55 2008
New Revision: 1737
URL: http://svn.gnome.org/viewvc/conduit?rev=1737&view=rev

Log:
2008-10-05  John Stowers  <john stowers gmail com>

	* conduit/gtkui/UI.py:
	* conduit/modules/iPodModule/iPodModule.py: The gpod module fails
    to import if a different locale is used. 

	* configure.ac: Fix generation of the locale directory in defs.py
    Fixes #532854.



Added:
   trunk/scripts/make-local-translations.sh   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/conduit/gtkui/UI.py
   trunk/conduit/modules/iPodModule/iPodModule.py
   trunk/configure.ac
   trunk/m4/intltool.m4
   trunk/scripts/ChangeLog

Modified: trunk/conduit/gtkui/UI.py
==============================================================================
--- trunk/conduit/gtkui/UI.py	(original)
+++ trunk/conduit/gtkui/UI.py	Sun Oct  5 11:24:55 2008
@@ -39,6 +39,9 @@
 for module in gtk.glade, gettext:
     module.bindtextdomain('conduit', conduit.LOCALE_DIR)
     module.textdomain('conduit')
+    if hasattr(module, 'bind_textdomain_codeset'):
+        module.bind_textdomain_codeset('conduit','UTF-8')
+
 
 class _PreconfiguredConduitMenu(gtk.Menu):
     def __init__(self):

Modified: trunk/conduit/modules/iPodModule/iPodModule.py
==============================================================================
--- trunk/conduit/modules/iPodModule/iPodModule.py	(original)
+++ trunk/conduit/modules/iPodModule/iPodModule.py	Sun Oct  5 11:24:55 2008
@@ -18,7 +18,6 @@
 import locale
 import weakref
 import threading
-DEFAULT_ENCODING = locale.getpreferredencoding()
 log = logging.getLogger("modules.iPod")
 
 import conduit
@@ -35,17 +34,19 @@
 
 from gettext import gettext as _
 
-MODULES = {
-    "iPodFactory" :         { "type":   "dataprovider-factory"  },
-}
-
 try:
     import gpod
-    LIBGPOD_PHOTOS = gpod.version_info >= (0,6,0)
-    log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
+    if gpod.version_info >= (0,6,0):
+        MODULES = {
+            "iPodFactory" :         { "type":   "dataprovider-factory"  },
+        }
+        log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
 except ImportError:
-    LIBGPOD_PHOTOS = False
-    log.info("iPod photo support disabled")
+    MODULES = {}
+    log.info("iPod support disabled")
+except locale.Error:
+    MODULES = {}
+    log.info("iPod support disabled (Incorrect locale)")
 
 def _string_to_unqiue_file(txt, base_uri, prefix, postfix=''):
     for i in range(1, 10000):
@@ -75,17 +76,16 @@
                     kwargs['mount'])
 
     def get_dataproviders(self, udi, **kwargs):
-        if LIBGPOD_PHOTOS:
-            #Read information about the ipod, like if it supports
-            #photos or not
-            d = gpod.itdb_device_new()
-            gpod.itdb_device_set_mountpoint(d,kwargs['mount'])
-            supportsPhotos = gpod.itdb_device_supports_photo(d)
-            gpod.itdb_device_free(d)
-            if supportsPhotos:
-                return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay, IPodPhotoSink]
-
-        return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay]
+        #Read information about the ipod, like if it supports
+        #photos or not
+        d = gpod.itdb_device_new()
+        gpod.itdb_device_set_mountpoint(d,kwargs['mount'])
+        supportsPhotos = gpod.itdb_device_supports_photo(d)
+        gpod.itdb_device_free(d)
+        if supportsPhotos:
+            return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay, IPodPhotoSink]
+        else:
+            return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay]
 
 
 class IPodBase(DataProvider.TwoWay):
@@ -544,7 +544,7 @@
         self.track['time_added'] = int(time.time())
         self.track['userdata'] = {'transferred': 0,
                                   'hostname': socket.gethostname(),
-                                  'charset': DEFAULT_ENCODING}
+                                  'charset': locale.getpreferredencoding()}
         self.track._set_userdata_utf8('filename', f.get_local_uri())
 
     #FIXME: Remove this. Use native operations from Conduit instead.
@@ -836,8 +836,8 @@
     _configurable_ = True
 
     _mediatype_ = (gpod.ITDB_MEDIATYPE_MUSICVIDEO,
-                   gpod.ITDB_MEDIATYPE_MOVIE,
-                   gpod.ITDB_MEDIATYPE_TVSHOW)
+                  gpod.ITDB_MEDIATYPE_MOVIE,
+                  gpod.ITDB_MEDIATYPE_TVSHOW)
     _mediafile_ = Video.Video
     _ipodmedia_ = IPodVideo
 

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sun Oct  5 11:24:55 2008
@@ -117,7 +117,7 @@
 AS_AC_EXPAND(PYTHONDIR, $pythondir)
 AS_AC_EXPAND(BINDIR, $bindir)
 AS_AC_EXPAND(LIBDIR, $libdir)
-AS_AC_EXPAND(LOCALEDIR, $localedir)
+AS_AC_EXPAND(LOCALEDIR, $datarootdir/locale)
 AS_AC_EXPAND(PKGDATADIR, $datarootdir/$PACKAGE)
 AS_AC_EXPAND(MODULEDIR, $libdir/$PACKAGE/modules)
 

Modified: trunk/m4/intltool.m4
==============================================================================
--- trunk/m4/intltool.m4	(original)
+++ trunk/m4/intltool.m4	Sun Oct  5 11:24:55 2008
@@ -23,9 +23,10 @@
 ## the same distribution terms that you use for the rest of that program.
 
 dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
-# serial 36 IT_PROG_INTLTOOL
-AC_DEFUN([IT_PROG_INTLTOOL],
-[AC_PREREQ([2.50])dnl
+# serial 40 IT_PROG_INTLTOOL
+AC_DEFUN([IT_PROG_INTLTOOL], [
+AC_PREREQ([2.50])dnl
+AC_REQUIRE([AM_NLS])dnl
 
 case "$am__api_version" in
     1.[01234])
@@ -39,14 +40,21 @@
     AC_MSG_CHECKING([for intltool >= $1])
 
     INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
-    INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in`
-    [INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in`
+    INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
+    [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
     ]
     AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
     test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
 	AC_MSG_ERROR([Your intltool is too old.  You need intltool $1 or later.])
 fi
 
+AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
+AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
+AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
+if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
+    AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.])
+fi
+
   INTLTOOL_DESKTOP_RULE='%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
 INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
      INTLTOOL_KEYS_RULE='%.keys:      %.keys.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' 
@@ -91,6 +99,7 @@
 AC_PATH_PROG(XGETTEXT, xgettext)
 AC_PATH_PROG(MSGMERGE, msgmerge)
 AC_PATH_PROG(MSGFMT, msgfmt)
+AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
 if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
     AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
 fi
@@ -101,12 +110,7 @@
     AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
 fi
 
-# Use the tools built into the package, not the ones that are installed.
-AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract')
-AC_SUBST(INTLTOOL_MERGE, '$(top_builddir)/intltool-merge')
-AC_SUBST(INTLTOOL_UPDATE, '$(top_builddir)/intltool-update')
-
-AC_PATH_PROG(INTLTOOL_PERL, perl)
+AC_PATH_PROG(INTLTOOL_PERL, [perl])
 if test -z "$INTLTOOL_PERL"; then
    AC_MSG_ERROR([perl not found; required for intltool])
 fi
@@ -152,42 +156,6 @@
 
 IT_PO_SUBDIR([po])
 
-dnl The following is very similar to
-dnl
-dnl	AC_CONFIG_FILES([intltool-extract intltool-merge intltool-update])
-dnl
-dnl with the following slight differences:
-dnl  - the *.in files are in ac_aux_dir,
-dnl  - if the file haven't changed upon reconfigure, it's not touched,
-dnl  - the evaluation of the third parameter enables a hack which computes
-dnl    the actual value of $libdir,
-dnl  - the user sees "executing intltool commands", instead of
-dnl    "creating intltool-extract" and such.
-dnl
-dnl Nothing crucial here, and we could use AC_CONFIG_FILES, if there were
-dnl a reason for it.
-
-AC_CONFIG_COMMANDS([intltool], [
-
-for file in intltool-extract intltool-merge intltool-update; do
-  sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \
-      -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \
-      -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \
-	< ${ac_aux_dir}/${file}.in > ${file}.out
-  if cmp -s ${file} ${file}.out 2>/dev/null; then
-    rm -f ${file}.out
-  else
-    mv -f ${file}.out ${file}
-  fi
-  chmod ugo+x ${file}
-  chmod u+w ${file}
-done
-
-],
-[INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}'
-prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir" 
-INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}'])
-
 ])
 
 
@@ -211,22 +179,17 @@
 	'"s|^|	$ac_top_srcdir/|" \
       "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
     ]
-    if test ! -f "$1/Makefile"; then
-      AC_MSG_ERROR([$1/Makefile is not ready.])
-    fi
-    mv "$1/Makefile" "$1/Makefile.tmp"
     [sed '/^POTFILES =/,/[^\\]$/ {
 		/^POTFILES =/!d
 		r $1/POTFILES
 	  }
-	 ' "$1/Makefile.tmp" >"$1/Makefile"]
+	 ' "$1/Makefile.in" >"$1/Makefile"]
     rm -f "$1/Makefile.tmp"
     mv "$1/stamp-it.tmp" "$1/stamp-it"
   ])
 ])dnl
 ])
 
-
 # deprecated macros
 AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
 # A hint is needed for aclocal from Automake <= 1.9.4:

Added: trunk/scripts/make-local-translations.sh
==============================================================================
--- (empty file)
+++ trunk/scripts/make-local-translations.sh	Sun Oct  5 11:24:55 2008
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ ! -f "conduit/conduit" ] ; then
+    echo "ERROR: Must be run from top directory\n$USAGE"
+    exit 1
+fi
+
+cd po &>/dev/null
+POS=`ls *.po`
+cd - &>/dev/null
+
+for p in $POS
+do
+    out=po/`echo $p | sed -e 's/\.po//'`/LC_MESSAGES
+    mkdir -p $out
+    msgfmt --output-file=$out/conduit.mo po/$p 
+done
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]