[kupfer] wscript: Install plugin datafiles inside python packages



commit 94d9da4d09bf38773a387f222dae22b6c751c52b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Feb 8 13:43:13 2010 +0100

    wscript: Install plugin datafiles inside python packages
    
    Plugins may now embed datafiles directly inside their python packages.
    We update the wscript file to install icon-list and .svg files.

 wscript |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/wscript b/wscript
index e02ebba..1f6b3f4 100644
--- a/wscript
+++ b/wscript
@@ -150,7 +150,19 @@ def _new_package(bld, name):
 	obj = bld.new_task_gen("py")
 	obj.find_sources_in_dirs(name)
 	obj.install_path = "${PYTHONDIR}/%s" % name
-	return obj
+
+	# Find embedded package datafiles
+	pkgnode = bld.path.find_dir(name)
+	bld.rescan(pkgnode)
+
+	def is_datafile(fname):
+		if fname in ["icon-list"]:
+			return True
+		return os.path.splitext(fname)[-1] in set([".png", ".svg"])
+
+	for dfile in filter(is_datafile, bld.cache_dir_contents[pkgnode.id]):
+		bld.install_files(obj.install_path,
+				"%s/%s" % (pkgnode.abspath(), dfile))
 
 def _find_packages_in_directory(bld, name):
 	"""Go through directory @name and recursively add all



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