Switching to a more automatic route for things
authorepage <eopage@byu.net>
Fri, 20 Mar 2009 00:27:09 +0000 (00:27 +0000)
committerepage <eopage@byu.net>
Fri, 20 Mar 2009 00:27:09 +0000 (00:27 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@228 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

Makefile
support/builddeb.py

index e3f6803..c2c5383 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,9 @@
 PROJECT_NAME=dialcentral
 SOURCE_PATH=src
-SOURCE=$(SOURCE_PATH)/dialer.py \
-          $(SOURCE_PATH)/gtk_toolbox.py \
-          $(SOURCE_PATH)/gc_views.py \
-          $(SOURCE_PATH)/null_views.py \
-          $(SOURCE_PATH)/file_backend.py \
-          $(SOURCE_PATH)/evo_backend.py \
-          $(SOURCE_PATH)/gdata_backend.py \
-          $(SOURCE_PATH)/gv_backend.py \
-          $(SOURCE_PATH)/gc_backend.py \
-          $(SOURCE_PATH)/browser_emu.py \
-          $(SOURCE_PATH)/__init__.py \
-
+SOURCE=$(shell find $(SOURCE_PATH) -iname *.py)
 PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
+DATA_TYPES=*.ini *.map *.glade *.png
+DATA=$(foreach type, $(DATA_TYPES), $(shell find $(SOURCE_PATH) -iname $(type)))
 OBJ=$(SOURCE:.py=.pyc)
 BUILD_PATH=./build/
 TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
@@ -26,12 +17,12 @@ PROFILE_GEN=python -m cProfile -o .profile
 PROFILE_VIEW=python -m pstats .profile
 CTAGS=ctags-exuberant
 
-.PHONY: all run debug test lint tags package clean distclean
+.PHONY: all run profile debug test lint tags package clean distclean
 
 all: test package
 
 run: $(SOURCE)
-       $(SOURCE_PATH)/gc_dialer.py
+       $(SOURCE_PATH)/dc_glade.py
 
 profile: $(SOURCE)
        $(PROFILE_GEN) $(PROGRAM)
@@ -47,9 +38,9 @@ package:
        rm -Rf $(BUILD_PATH)
        mkdir $(BUILD_PATH)
        cp $(SOURCE_PATH)/$(PROJECT_NAME).py  $(BUILD_PATH)
-       cp $(SOURCE_PATH)/$(PROJECT_NAME).glade  $(BUILD_PATH)
-       cp $(SOURCE)  $(BUILD_PATH)
-       cp $(OBJ)  $(BUILD_PATH)
+       $(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
+       $(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
+       $(foreach file, $(OBJ), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
        cp support/$(PROJECT_NAME).desktop $(BUILD_PATH)
        cp support/icons/hicolor/26x26/hildon/$(PROJECT_NAME).png $(BUILD_PATH)/26x26-$(PROJECT_NAME).png
        cp support/icons/hicolor/64x64/hildon/$(PROJECT_NAME).png $(BUILD_PATH)/64x64-$(PROJECT_NAME).png
index 9a1c2c5..06f222a 100755 (executable)
@@ -48,6 +48,26 @@ gtk-update-icon-cache /usr/share/icons/hicolor
 '''
 
 
+def find_files(path):
+       for root, dirs, files in os.walk(path):
+               for file in files:
+                       if file.startswith("src-"):
+                               fileParts = file.split("-")
+                               unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
+                               assert unused == "src"
+                               relPath = os.sep.join(relPathParts)
+                               yield relPath, file, newName
+
+
+def unflatten_files(files):
+       d = {}
+       for relPath, oldName, newName in files:
+               if relPath not in d:
+                       d[relPath] = []
+               d[relPath].append((oldName, newName))
+       return d
+
+
 if __name__ == "__main__":
        try:
                os.chdir(os.path.dirname(sys.argv[0]))
@@ -60,7 +80,6 @@ if __name__ == "__main__":
        p.mail = __email__
        p.license = "lgpl"
        p.depends = "python2.5, python2.5-gtk2"
-       # p.section = "user/utilities"
        p.section = "user/communication"
        p.arch = "all"
        p.urgency = "low"
@@ -70,29 +89,14 @@ if __name__ == "__main__":
        p.postinstall = __postinstall__
        p.icon="26x26-dialcentral.png"
        p["/usr/bin"] = [ "dialcentral.py" ]
-       p["/usr/lib/dialcentral"] = [
-               "dialcentral.glade",
-               "__init__.py",
-               "dialer.py",
-               "browser_emu.py",
-               "file_backend.py",
-               "evo_backend.py",
-               "gc_backend.py",
-               "gv_backend.py",
-               "gc_views.py",
-               "null_views.py",
-               "gtk_toolbox.py",
-               "__init__.pyc",
-               "dialer.pyc",
-               "browser_emu.pyc",
-               "file_backend.pyc",
-               "evo_backend.pyc",
-               "gc_backend.pyc",
-               "gv_backend.pyc",
-               "gc_views.pyc",
-               "null_views.pyc",
-               "gtk_toolbox.pyc",
-       ]
+       for relPath, files in unflatten_files(find_files(".")).iteritems():
+               fullPath = "/usr/lib/dialcentral"
+               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"]