Pulling in improvements from Dialcentral
authorepage <eopage@byu.net>
Sat, 13 Jun 2009 01:34:42 +0000 (01:34 +0000)
committerepage <eopage@byu.net>
Sat, 13 Jun 2009 01:34:42 +0000 (01:34 +0000)
git-svn-id: file:///svnroot/ejpi/trunk@49 df6cc7de-23d0-4ae0-bb86-c17aa67b2a9d

Makefile
src/libraries/recipes/test_utils.py
support/builddeb.py
support/fake_py2deb.py [new file with mode: 0644]

index 4ceb0d7..e5ed1a0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,7 @@ build: $(OBJ)
        cp support/icons/64.png $(BUILD_PATH)/64x64-$(PROJECT_NAME).png
        cp support/icons/scalable.png $(BUILD_PATH)/scale-$(PROJECT_NAME).png
        cp support/builddeb.py $(BUILD_PATH)
+       cp support/fake_py2deb.py $(BUILD_PATH)
 
 lint: $(OBJ)
        $(foreach file, $(SOURCE), $(LINT) $(file) ; )
index d238bfa..a2da797 100644 (file)
@@ -113,8 +113,8 @@ def expected(exception):
        """
        if isinstance(exception, Exception):
                excType, excValue = type(exception), str(exception)
-       elif isinstance(e, type):
-               excType, excValue = e, ""
+       elif isinstance(exception, type):
+               excType, excValue = exception, ""
 
        try:
                yield
@@ -127,4 +127,4 @@ def expected(exception):
 
 if __name__ == "__main__":
        import doctest
-       doctest.testmod()
\ No newline at end of file
+       doctest.testmod()
index d7becb1..41bce27 100755 (executable)
@@ -3,7 +3,10 @@
 import os
 import sys
 
-import py2deb
+try:
+       import py2deb
+except ImportError:
+       import fake_py2deb as py2deb
 
 import constants
 
@@ -46,9 +49,9 @@ __changelog__ = '''
 '''
 
 
-__postinstall__ = '''#!/bin/sh
+__postinstall__ = '''#!/bin/sh -e
 
-gtk-update-icon-cache /usr/share/icons/hicolor
+gtk-update-icon-cache -f /usr/share/icons/hicolor
 '''
 
 
@@ -72,7 +75,7 @@ def unflatten_files(files):
        return d
 
 
-if __name__ == "__main__":
+def build_package(distribution):
        try:
                os.chdir(os.path.dirname(sys.argv[0]))
        except:
@@ -83,15 +86,18 @@ if __name__ == "__main__":
        p.author = __author__
        p.mail = __email__
        p.license = "lgpl"
-       p.depends = "python2.5, python2.5-gtk2"
+       p.depends = {
+               "diablo": "python2.5, python2.5-gtk2",
+               "mer": "python2.6, python-gtk2, python-glade2",
+       }[distribution]
        p.section = "user/accessories"
        p.arch = "all"
        p.urgency = "low"
-       p.distribution = "chinook diablo"
+       p.distribution = "chinook diablo fremantle mer"
        p.repository = "extras"
        p.changelog = __changelog__
        p.postinstall = __postinstall__
-       p.icon="26x26-ejpi.png"
+       p.icon = "26x26-ejpi.png"
        p["/usr/bin"] = [ "ejpi.py" ]
        for relPath, files in unflatten_files(find_files(".")).iteritems():
                fullPath = "/usr/lib/ejpi"
@@ -111,3 +117,20 @@ if __name__ == "__main__":
                __version__, __build__, changelog=__changelog__,
                tar=True, dsc=True, changes=True, build=False, src=True
        )
+       print "Building for %s finished" % distribution
+
+
+if __name__ == "__main__":
+       if len(sys.argv) > 1:
+               try:
+                       import optparse
+               except ImportError:
+                       optparse = None
+
+               if optparse is not None:
+                       parser = optparse.OptionParser()
+                       (commandOptions, commandArgs) = parser.parse_args()
+       else:
+               commandArgs = None
+               commandArgs = ["diablo"]
+       build_package(commandArgs[0])
diff --git a/support/fake_py2deb.py b/support/fake_py2deb.py
new file mode 100644 (file)
index 0000000..5d6149d
--- /dev/null
@@ -0,0 +1,56 @@
+import pprint
+
+
+class Py2deb(object):
+
+       def __init__(self, appName):
+               self._appName = appName
+               self.description = ""
+               self.author = ""
+               self.mail = ""
+               self.license = ""
+               self.depends = ""
+               self.section = ""
+               self.arch = ""
+               self.ugency = ""
+               self.distribution = ""
+               self.repository = ""
+               self.changelog = ""
+               self.postinstall = ""
+               self.icon = ""
+               self._install = {}
+
+       def generate(self, appVersion, appBuild, changelog, tar, dsc, changes, build, src):
+               return """
+Package: %s
+version: %s-%s
+Changes:
+%s
+
+Build Options:
+       Tar: %s
+       Dsc: %s
+       Changes: %s
+       Build: %s
+       Src: %s
+               """ % (
+                       self._appName, appVersion, appBuild, changelog, tar, dsc, changes, build, src
+               )
+
+       def __str__(self):
+               parts = []
+               parts.append("%s Package Settings:" % (self._appName, ))
+               for settingName in dir(self):
+                       if settingName.startswith("_"):
+                               continue
+                       parts.append("\t%s: %s" % (settingName, getattr(self, settingName)))
+
+               parts.append(pprint.pformat(self._install))
+
+               return "\n".join(parts)
+
+       def __getitem__(self, key):
+               return self._install[key]
+
+       def __setitem__(self, key, item):
+               self._install[key] = item