Adding data support
authorEd Page <eopage@byu.net>
Thu, 2 Dec 2010 03:15:29 +0000 (21:15 -0600)
committerEd Page <eopage@byu.net>
Thu, 2 Dec 2010 03:15:29 +0000 (21:15 -0600)
Makefile
support/builddeb.py
support/py2deb.py

index 68063d5..9f128fa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,9 @@ PROJECT_NAME=dialcentral
 SOURCE_PATH=src
 SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")
 PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
+DATA_PATH=data
 DATA_TYPES=*.ini *.map *.glade *.png
-DATA=$(foreach type, $(DATA_TYPES), $(shell find $(SOURCE_PATH) -iname "$(type)"))
+DATA=$(foreach type, $(DATA_TYPES), $(shell find $(DATA_PATH) -iname "$(type)"))
 OBJ=$(SOURCE:.py=.pyc)
 BUILD_PATH=./build
 TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
index faa5e33..0870254 100755 (executable)
@@ -127,6 +127,14 @@ def build_package(distribution):
                        "|".join((oldName, newName))
                        for (oldName, newName) in files
                )
+       for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
+               fullPath = "/opt/%s/share" % __appname__
+               if relPath:
+                       fullPath += os.sep+relPath
+               p[fullPath] = list(
+                       "|".join((oldName, newName))
+                       for (oldName, newName) in files
+               )
        p["/usr/share/applications/hildon"] = ["dialcentral.desktop"]
        p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-dialcentral.png|dialcentral.png"]
        p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-dialcentral.png|dialcentral.png"]
index 4a47513..0518480 100644 (file)
@@ -473,6 +473,9 @@ class Py2deb(object):
 
         self.__files[path]=nfiles
 
+    def __getitem__(self, k):
+        return self.__files[k]
+
     def __delitem__(self, k):
         del self.__files[k]