[kupfer] Fix updating icon cache and mimetype registry after install



commit 2beab70767268b28d367914216d776ef6e63210b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Apr 5 20:58:53 2011 +0200

    Fix updating icon cache and mimetype registry after install
    
    A regression from the Waf 1.6 upgrade, the updating commands were run
    before the files were installed, not after. This is now fixed.
    
    Also add the option --no-update-icon-cache matching --no-update-mime

 Documentation/VersionHistory.rst |    2 ++
 auxdata/wscript                  |   22 ++++++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/Documentation/VersionHistory.rst b/Documentation/VersionHistory.rst
index 6f35fb3..05da27f 100644
--- a/Documentation/VersionHistory.rst
+++ b/Documentation/VersionHistory.rst
@@ -31,6 +31,8 @@ all the features introduced in v205.
 * Support xfce4-dict in *Dictionary* plugin (David Schneider)
 * Make sure ``kupfer.svg`` can be mimetype-detected (NAKAMURA Yoshitaka)
   (:lp:`750488`)
+* Fix regression that prevented mimetypes and icon cache from being updated
+  properly when installing from source.
 
 These are the full change explanations of the v205 release
 
diff --git a/auxdata/wscript b/auxdata/wscript
index c151632..cbcc4fe 100644
--- a/auxdata/wscript
+++ b/auxdata/wscript
@@ -7,10 +7,16 @@ def options(opt):
 			action='store_true',
 			default=False,
 			help='Do not update mime and desktop databases [Default:Update]')
+	opt.add_option('--no-update-icon-cache',
+			action='store_true',
+			default=False,
+			help='Do not update icon cache [Default:Update]')
 
 def configure(conf):
 	if not Options.options.no_update_mime:
 		conf.env["AUXDATA_MIME"] = 1
+	if not Options.options.no_update_icon_cache:
+		conf.env["UPDATE_ICON_CACHE"] = 1
 
 
 def build(bld):
@@ -30,7 +36,7 @@ def build(bld):
 	install_desktop_file("kupfer.desktop")
 	install_desktop_file("kupfer-exec.desktop")
 
-	# install mimetype descriptions
+	## install mimetype descriptions
 
 	mimetypes_file = "kupfer-mimetypes.xml"
 	bld(
@@ -42,17 +48,22 @@ def build(bld):
 		install_path = "${DATADIR}/mime/packages/",
 	)
 
-	if bld.is_install and bld.env["AUXDATA_MIME"]:
+
+	def update_mime(bld):
+		Logs.pprint('GREEN',"Updating mime database")
 		bld.exec_command(["update-mime-database",
 				Utils.subst_vars("${DATADIR}/mime", bld.env)])
 		bld.exec_command(["update-desktop-database",
 				Utils.subst_vars("${DATADIR}/applications", bld.env)])
 
+	if bld.is_install and bld.env["AUXDATA_MIME"]:
+		bld.add_post_fun(update_mime)
+
+	## install kupfer.svg icon
 	icons_inst = bld.install_files("${DATADIR}/icons/hicolor/scalable/apps",
 	                               "kupfer.svg")
 
-	# Waf's "gnome" tool  -- def postinstall_icons():
-	if icons_inst and bld.is_install:
+	def update_icon_cache(bld):
 		icon_dir = Utils.subst_vars('${DATADIR}/icons/hicolor', bld.env)
 		if not Options.options.destdir:
 			Logs.pprint('GREEN',"Updating Gtk icon cache.")
@@ -61,3 +72,6 @@ def build(bld):
 		else:
 			Logs.pprint('YELLOW','Icon cache not updated. After install, run this:')
 			Logs.pprint('YELLOW','gtk-update-icon-cache -q -f -t %s'%icon_dir)
+
+	if icons_inst and bld.is_install and bld.env["UPDATE_ICON_CACHE"]:
+		bld.add_post_fun(update_icon_cache)



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