Fixing icon sizes
[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 = """Switching from py2deb.py to sdist_maemo
41 """.strip()
42 BUGTRACKER_URL = "https://bugs.maemo.org/enter_bug.cgi?product=Gonvert"
43
44
45 def is_package(path):
46         return (
47                 os.path.isdir(path) and
48                 os.path.isfile(os.path.join(path, '__init__.py'))
49         )
50
51
52 def find_packages(path, base="", includeRoot=False):
53         """ Find all packages in path """
54         if includeRoot:
55                 assert not base, "Base not supported with includeRoot: %r" % base
56                 rootPath, module_name = os.path.split(path)
57                 yield module_name
58                 base = module_name
59         for item in os.listdir(path):
60                 dir = os.path.join(path, item)
61                 if is_package( dir ):
62                         if base:
63                                 module_name = "%(base)s.%(item)s" % vars()
64                         else:
65                                 module_name = item
66                         yield module_name
67                         for mname in find_packages(dir, module_name):
68                                 yield mname
69
70
71 setup(
72         name=APP_NAME,
73         version=VERSION,
74         description="Unit Conversions",
75         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",
76         author="Ed Page",
77         author_email="eopage@byu.net",
78         maintainer="Ed Page",
79         maintainer_email="eopage@byu.net",
80         url="http://gonvert.garage.maemo.org",
81         license="GNU GPLv2",
82         scripts=[
83                 "Gonvert",
84         ],
85         packages=list(find_packages(APP_NAME, includeRoot=True)),
86         package_data={
87         },
88         data_files=[
89                 (DESKTOP_FILE_PATH, [INPUT_DESKTOP_FILE]),
90         ] +
91         [
92                 (
93                         "/usr/share/icons/hicolor/%sx%s/%s" % (size, size, ICON_CATEGORY),
94                         ["data/icons/%s/%s.png" % (size, APP_NAME)]
95                 )
96                 for size in ICON_SIZES
97         ],
98         requires=[
99                 "PySide",
100                 "simplejson",
101         ],
102         cmdclass={
103                 'sdist_ubuntu': sdist_maemo,
104                 'sdist_diablo': sdist_maemo,
105                 'sdist_fremantle': sdist_maemo,
106                 'sdist_harmattan': sdist_maemo,
107         },
108         options={
109                 "sdist_ubuntu": {
110                         "debian_package": APP_NAME,
111                         "section": "science",
112                         "copyright": "gpl",
113                         "changelog": CHANGES,
114                         "buildversion": str(BUILD),
115                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-simplejson",
116                         "architecture": "any",
117                 },
118                 "sdist_diablo": {
119                         "debian_package": APP_NAME,
120                         "Maemo_Display_Name": PRETTY_APP_NAME,
121                         #"Maemo_Upgrade_Description": CHANGES,
122                         "Maemo_Bugtracker": BUGTRACKER_URL,
123                         "Maemo_Icon_26": "data/icons/26/%s.png" % APP_NAME,
124                         "section": "user/science",
125                         "copyright": "gpl",
126                         "changelog": CHANGES,
127                         "buildversion": str(BUILD),
128                         "depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python-simplejson",
129                         "architecture": "any",
130                 },
131                 "sdist_fremantle": {
132                         "debian_package": APP_NAME,
133                         "Maemo_Display_Name": PRETTY_APP_NAME,
134                         #"Maemo_Upgrade_Description": CHANGES,
135                         "Maemo_Bugtracker": BUGTRACKER_URL,
136                         "Maemo_Icon_26": "data/icons/48/%s.png" % APP_NAME,
137                         "section": "user/science",
138                         "copyright": "gpl",
139                         "changelog": CHANGES,
140                         "buildversion": str(BUILD),
141                         "depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python2.5-qt4-maemo5, python-simplejson",
142                         #"depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-pyside.qtmaemo5, python-simplejson",
143                         "architecture": "any",
144                 },
145                 "sdist_harmattan": {
146                         "debian_package": APP_NAME,
147                         "Maemo_Display_Name": PRETTY_APP_NAME,
148                         #"Maemo_Upgrade_Description": CHANGES,
149                         "Maemo_Bugtracker": BUGTRACKER_URL,
150                         "Maemo_Icon_26": "data/icons/48/%s.png" % APP_NAME,
151                         "MeeGo_Desktop_Entry_Filename": APP_NAME,
152                         #"MeeGo_Desktop_Entry": "",
153                         "section": "user/science",
154                         "copyright": "gpl",
155                         "changelog": CHANGES,
156                         "buildversion": str(BUILD),
157                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-simplejson",
158                         "architecture": "any",
159                 },
160                 "bdist_rpm": {
161                         "requires": "REPLACEME",
162                         "icon": "data/icons/48/%s.png" % APP_NAME,
163                         "group": "REPLACEME",
164                 },
165         },
166 )