Switching deps to PySide
[gc-dialer] / support / builddeb.py
index 722889b..8500d2f 100755 (executable)
@@ -1,70 +1,57 @@
 #!/usr/bin/python2.5
 
-from py2deb import *
-
-
-__appname__ = "dialcentral"
-__description__ = "Simple interface to Google's GrandCentral(tm) service"
+import os
+import sys
+
+try:
+       import py2deb
+except ImportError:
+       import fake_py2deb as py2deb
+
+import constants
+
+
+__appname__ = constants.__app_name__
+__description__ = """Touch screen enhanced interface to the GoogleVoice phone service
+Features:
+.
+* Dialpad for quick call
+.
+* Checking voicemails, texts, call history
+.
+* Sending texts
+.
+* Notification support for texts, voicemail, and/or missed calls
+.
+Homepage: http://gc-dialer.garage.maemo.org/
+"""
 __author__ = "Ed Page"
 __email__ = "eopage@byu.net"
-__version__ = "0.9.3"
-__build__ = 0
-__changelog__ = '''\
-0.9.3 - ""
-
-
-0.9.2 - "Two heads are better than one"
- * Adding of UI to switch between GC and GV
- * Minimized flashing the dial button between grayed out and not on startup
- * Bug fixes
-
-0.9.1 - "Get your hands off that"
- * GoogleVoice Support, what a pain
- * More flexible CSV support.  It now checks the header row for what column name/number are in
- * Experimenting with faster startup by caching PYC files with the package
- * Fixing of some bad error handling
- * More debug output for when people run into issues
+__version__ = constants.__version__
+__build__ = constants.__build__
+__changelog__ = """
+* Couldn't update SMS conversations in SMS window, fixed
+""".strip()
 
-0.9.0 - "Slick as snot"
- * Caching of contacts
- * Refactoring to make working with the code easier
- * Filesystem backed contacts but currently only supporting a specific csv format
- * Gracefully handle lack of connection and connection transitions
- * Gracefully handle failed login
- * A tiny bit better error reporting
 
-0.8.3 - "Extras Love"
- * Version bump fighting the extras autobuilder, I hope this works
+__postinstall__ = """#!/bin/sh -e
 
-0.8.2 - "Feed is for horses, so what about feedback?"
- * Merged addressbook
- * many more smaller fixes
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+""" % {"name": constants.__app_name__}
 
-0.8.1 - "Two Beers"
- * Thumb scrollbars ( Kudos Khertan )
+__preremove__ = """#!/bin/sh -e
 
-0.8.0 - "Spit and polish"
- * Addressbook support
- * threaded networking for better interactivity
- * Hold down back to clear number
- * Standard about dialog
- * many more smaller fixes
-'''
+python /opt/dialcentral/lib/alarm_handler.py -d || true
+"""
 
 
-__postinstall__ = '''#!/bin/sh
-
-gtk-update-icon-cache /usr/share/icons/hicolor
-'''
-
-
-def find_files(path):
+def find_files(prefix, path):
        for root, dirs, files in os.walk(path):
                for file in files:
-                       if file.startswith("src-"):
+                       if file.startswith(prefix+"-"):
                                fileParts = file.split("-")
                                unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
-                               assert unused == "src"
+                               assert unused == prefix
                                relPath = os.sep.join(relPathParts)
                                yield relPath, file, newName
 
@@ -78,29 +65,61 @@ def unflatten_files(files):
        return d
 
 
-if __name__ == "__main__":
+def build_package(distribution):
        try:
                os.chdir(os.path.dirname(sys.argv[0]))
        except:
                pass
 
-       p = Py2deb(__appname__)
+       py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
+       p = py2deb.Py2deb(__appname__)
+       p.prettyName = constants.__pretty_app_name__
        p.description = __description__
+       p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Dialcentral"
        p.author = __author__
        p.mail = __email__
        p.license = "lgpl"
-       p.depends = "python2.5, python2.5-gtk2"
-       p.section = "user/communication"
+       p.depends = ", ".join([
+               "python2.6 | python2.5",
+               "python-xml | python2.5-xml",
+               "python-dbus | python2.5-dbus",
+               "python-simplejson",
+       ])
+       p.depends += {
+               "debian": ", python-qt4",
+               "diablo": ", python2.5-qt4-core, python2.5-qt4-gui",
+               "fremantle": ", python-pyside.qtgui, python-pyside.qtcore, python-pyside.qtmaemo5, python-qtmobility.contacts",
+       }[distribution]
+       p.recommends = ", ".join([
+       ])
+       p.section = {
+               "debian": "comm",
+               "diablo": "user/network",
+               "fremantle": "user/network",
+       }[distribution]
        p.arch = "all"
        p.urgency = "low"
-       p.distribution = "chinook diablo"
-       p.repository = "extras-devel"
+       p.distribution = "diablo fremantle debian"
+       p.repository = "extras"
        p.changelog = __changelog__
        p.postinstall = __postinstall__
-       p.icon="26x26-dialcentral.png"
-       p["/usr/bin"] = [ "dialcentral.py" ]
-       for relPath, files in unflatten_files(find_files(".")).iteritems():
-               fullPath = "/usr/lib/dialcentral"
+       p.preremove = __preremove__
+       p.icon = {
+               "debian": "26x26-dialcentral.png",
+               "diablo": "26x26-dialcentral.png",
+               "fremantle": "64x64-dialcentral.png", # Fremantle natively uses 48x48
+       }[distribution]
+       p["/opt/%s/bin" % __appname__] = [ "%s.py" % __appname__ ]
+       for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
+               fullPath = "/opt/%s/lib" % __appname__
+               if relPath:
+                       fullPath += os.sep+relPath
+               p[fullPath] = list(
+                       "|".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(
@@ -113,7 +132,30 @@ if __name__ == "__main__":
        p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-dialcentral.png|dialcentral.png"]
 
        print p
-       print p.generate(
-               __version__, __build__, changelog=__changelog__,
-               tar=True, dsc=True, changes=True, build=False, src=True
-       )
+       if distribution == "debian":
+               print p.generate(
+                       version="%s-%s" % (__version__, __build__),
+                       changelog=__changelog__,
+                       build=True,
+                       tar=False,
+                       changes=False,
+                       dsc=False,
+               )
+       else:
+               print p.generate(
+                       version="%s-%s" % (__version__, __build__),
+                       changelog=__changelog__,
+                       build=False,
+                       tar=True,
+                       changes=True,
+                       dsc=True,
+               )
+       print "Building for %s finished" % distribution
+
+
+if __name__ == "__main__":
+       if len(sys.argv) == 1:
+               distribution = "fremantle"
+       else:
+               distribution = sys.argv[1]
+       build_package(distribution)