← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n] Rev 397: Replace InstallIcons with RecursiveInstall

 

------------------------------------------------------------
revno: 397
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: linuxdcpp-i18n
timestamp: Sun 2010-10-31 02:18:43 -0500
message:
  Replace InstallIcons with RecursiveInstall
modified:
  SConstruct


--
lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n

Your team LinuxDC++ Team is subscribed to branch lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-10-31 06:05:43 +0000
+++ SConstruct	2010-10-31 07:18:43 +0000
@@ -69,30 +69,16 @@
 	context.Result(revision)
 	return revision
 
-# Install app icons to share/icons and all others to share/linuxdcpp/icons
-def install_icons(env, icons_dir):
-	prefix = env['FAKE_ROOT'] + os.path.join(env['PREFIX'], 'share')
-
-	for root, dirs, files in os.walk(icons_dir):
-		for file in files:
-			(filename, ext) = file.rsplit('.', 1)
-
-			if (filename == PACKAGE):
-				target = os.path.join(prefix, root)
-			else:
-				target = os.path.join(prefix, PACKAGE, root)
-
-			src = os.path.join(root, file)
-			env.Alias('install', env.Install(dir = target, source = src))
-
-def recursive_install(env, source, target):
+# Recursively installs all files within the source folder to target. Optionally,
+# a filter function can be provided to prevent installation of certain files.
+def recursive_install(env, source, target, filter = None):
 	nodes = env.Glob(os.path.join(source, '*'))
 	target = os.path.join(target, os.path.basename(source))
 
 	for node in nodes:
 		if node.isdir():
-			env.RecursiveInstall(str(node), target)
-		else:
+			env.RecursiveInstall(str(node), target, filter)
+		elif filter == None or filter(node.name):
 			env.Alias('install', env.Install(target, node))
 
 def generate_message_catalogs(env):
@@ -178,7 +164,6 @@
 env.Append(BUILDERS = {'MoBuild' : mo_build})
 
 env.AddMethod(generate_message_catalogs, 'GenerateMessageCatalogs')
-env.AddMethod(install_icons, 'InstallIcons')
 env.AddMethod(recursive_install, 'RecursiveInstall')
 
 conf = env.Configure(
@@ -351,9 +336,13 @@
 	text_files = env.Glob('*.txt')
 	prefix = env['FAKE_ROOT'] + env['PREFIX']
 	desktop_file = os.path.join('data', PACKAGE + '.desktop')
+	app_icon_filter = lambda icon: os.path.splitext(icon)[0] == PACKAGE
+	regular_icon_filter = lambda icon: os.path.splitext(icon)[0] != PACKAGE
 
-	env.InstallIcons('icons/hicolor/')
+	env.RecursiveInstall('icons/hicolor', os.path.join(prefix, 'share', 'icons'), app_icon_filter)
+	env.RecursiveInstall('icons/hicolor', os.path.join(prefix, 'share', PACKAGE, 'icons'), regular_icon_filter)
 	env.RecursiveInstall(BUILD_LOCALE_PATH, os.path.join(prefix, 'share', 'locale'))
+
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', PACKAGE, 'glade'), source = glade_files))
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'doc', PACKAGE), source = text_files))
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'applications'), source = desktop_file))