Bump for harmattan
[gonvert] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import sys
5 reload(sys).setdefaultencoding("UTF-8")
6 import os
7
8 try:
9         from sdist_maemo import sdist_maemo as _sdist_maemo
10         sdist_maemo = _sdist_maemo
11 except ImportError:
12         sdist_maemo = None
13         print 'sdist_maemo command not available'
14
15 from distutils.core import setup
16
17
18 #[[[cog
19 #       import cog
20 #       from gonvert import constants
21 #       cog.outl('APP_NAME="%s"' % constants.__app_name__)
22 #       cog.outl('PRETTY_APP_NAME="%s"' % constants.__pretty_app_name__)
23 #       cog.outl('VERSION="%s"' % constants.__version__)
24 #       cog.outl('BUILD="%s"' % constants.__build__)
25 #       cog.outl('DESKTOP_FILE_PATH="%s"' % DESKTOP_FILE_PATH)
26 #       cog.outl('INPUT_DESKTOP_FILE="%s"' % INPUT_DESKTOP_FILE)
27 #       cog.outl('ICON_CATEGORY="%s"' % ICON_CATEGORY)
28 #       cog.outl('ICON_SIZES=[%s]' % ICON_SIZES)
29 #]]]
30 APP_NAME="gonvert"
31 PRETTY_APP_NAME="Gonvert"
32 VERSION="1.1.4"
33 BUILD="0"
34 DESKTOP_FILE_PATH="/usr/share/applications"
35 INPUT_DESKTOP_FILE="data/ubuntu/gonvert.desktop"
36 ICON_CATEGORY="apps"
37 ICON_SIZES=[32,48]
38 #[[[end]]] (checksum: fefe5943a0176aa799fab0d963c33832)
39
40 CHANGES = """* Support for PySide
41 * XDG Support
42 * Fixed a race condition
43 """.strip()
44 BUGTRACKER_URL = "https://bugs.maemo.org/enter_bug.cgi?product=Gonvert"
45
46
47 def is_package(path):
48         return (
49                 os.path.isdir(path) and
50                 os.path.isfile(os.path.join(path, '__init__.py'))
51         )
52
53
54 def find_packages(path, base="", includeRoot=False):
55         """ Find all packages in path """
56         if includeRoot:
57                 assert not base, "Base not supported with includeRoot: %r" % base
58                 rootPath, module_name = os.path.split(path)
59                 yield module_name
60                 base = module_name
61         for item in os.listdir(path):
62                 dir = os.path.join(path, item)
63                 if is_package( dir ):
64                         if base:
65                                 module_name = "%(base)s.%(item)s" % vars()
66                         else:
67                                 module_name = item
68                         yield module_name
69                         for mname in find_packages(dir, module_name):
70                                 yield mname
71
72
73 setup(
74         name=APP_NAME,
75         version=VERSION,
76         description="Unit Conversions",
77         long_description="A conversion utility that allows conversion between many units like CGS, Ancient, Imperial with many categories like length, mass, numbers, etc. All units converted values shown at once as you type",
78         author="Ed Page",
79         author_email="eopage@byu.net",
80         maintainer="Ed Page",
81         maintainer_email="eopage@byu.net",
82         url="http://gonvert.garage.maemo.org",
83         license="GNU GPLv2",
84         scripts=[
85                 "Gonvert",
86         ],
87         packages=list(find_packages(APP_NAME, includeRoot=True)),
88         package_data={
89         },
90         data_files=[
91                 (DESKTOP_FILE_PATH, [INPUT_DESKTOP_FILE]),
92                 ("/usr/share/icons/hicolor/scalable/apps", ["data/%s.svg" % APP_NAME]),
93         ] +
94         [
95                 (
96                         "/usr/share/icons/hicolor/%sx%s/%s" % (size, size, ICON_CATEGORY),
97                         ["data/icons/%s/%s.png" % (size, APP_NAME)]
98                 )
99                 for size in ICON_SIZES
100         ],
101         requires=[
102                 "PySide",
103                 "pyxdg",
104         ],
105         cmdclass={
106                 'sdist_ubuntu': sdist_maemo,
107                 'sdist_diablo': sdist_maemo,
108                 'sdist_fremantle': sdist_maemo,
109                 'sdist_harmattan': sdist_maemo,
110         },
111         options={
112                 "sdist_ubuntu": {
113                         "debian_package": APP_NAME,
114                         "section": "science",
115                         "copyright": "gpl",
116                         "changelog": CHANGES,
117                         "buildversion": str(BUILD),
118                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-xdg",
119                         "architecture": "any",
120                 },
121                 "sdist_diablo": {
122                         "debian_package": APP_NAME,
123                         "Maemo_Display_Name": PRETTY_APP_NAME,
124                         #"Maemo_Upgrade_Description": CHANGES,
125                         "Maemo_Bugtracker": BUGTRACKER_URL,
126                         "Maemo_Icon_26": "data/icons/26/%s.png" % APP_NAME,
127                         "section": "user/science",
128                         "copyright": "gpl",
129                         "changelog": CHANGES,
130                         "buildversion": str(BUILD),
131                         "depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python-xdg, python-simplejson",
132                         "architecture": "any",
133                 },
134                 "sdist_fremantle": {
135                         "debian_package": APP_NAME,
136                         "Maemo_Display_Name": PRETTY_APP_NAME,
137                         #"Maemo_Upgrade_Description": CHANGES,
138                         "Maemo_Bugtracker": BUGTRACKER_URL,
139                         "Maemo_Icon_26": "data/icons/48/%s.png" % APP_NAME,
140                         "section": "user/science",
141                         "copyright": "gpl",
142                         "changelog": CHANGES,
143                         "buildversion": str(BUILD),
144                         #"depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python2.5-qt4-maemo5, python-xdg, python-simplejson",
145                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-pyside.qtmaemo5, python-xdg, python-simplejson",
146                         "architecture": "any",
147                 },
148                 "sdist_harmattan": {
149                         "debian_package": APP_NAME,
150                         "Maemo_Display_Name": PRETTY_APP_NAME,
151                         #"Maemo_Upgrade_Description": CHANGES,
152                         "Maemo_Bugtracker": BUGTRACKER_URL,
153                         "Maemo_Icon_26": "data/icons/48/%s.png" % APP_NAME,
154                         "MeeGo_Desktop_Entry_Filename": APP_NAME,
155                         #"MeeGo_Desktop_Entry": "",
156                         "section": "user/science",
157                         "copyright": "gpl",
158                         "changelog": CHANGES,
159                         "buildversion": str(BUILD),
160                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-xdg",
161                         "architecture": "any",
162                 },
163                 "bdist_rpm": {
164                         "requires": "REPLACEME",
165                         "icon": "data/icons/48/%s.png" % APP_NAME,
166                         "group": "REPLACEME",
167                 },
168         },
169 )