Speeding up toggle of pyside/pyqt
[ejpi] / 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 from ejpi import constants
17
18
19 def is_package(path):
20         return (
21                 os.path.isdir(path) and
22                 os.path.isfile(os.path.join(path, '__init__.py'))
23         )
24
25
26 def find_packages(path, base="", includeRoot=False):
27         """ Find all packages in path """
28         if includeRoot:
29                 assert not base, "Base not supported with includeRoot: %r" % base
30                 rootPath, module_name = os.path.split(path)
31                 yield module_name
32                 base = module_name
33         for item in os.listdir(path):
34                 dir = os.path.join(path, item)
35                 if is_package( dir ):
36                         if base:
37                                 module_name = "%(base)s.%(item)s" % vars()
38                         else:
39                                 module_name = item
40                         yield module_name
41                         for mname in find_packages(dir, module_name):
42                                 yield mname
43
44
45 changes = ""
46 icon = "data/%s.png" % constants.__app_name__
47
48
49 setup(
50         name=constants.__app_name__,
51         version=constants.__version__,
52         description="RPN calculator designed for touchscreens",
53         long_description="RPN calculator designed for touchscreens",
54         author="Ed Page",
55         author_email="eopage@byu.net",
56         maintainer="Ed Page",
57         maintainer_email="eopage@byu.net",
58         url="http://ejpi.garage.maemo.org/",
59         license="GNU LGPLv2.1",
60         scripts=[
61                 "ejpi-calc",
62         ],
63         packages=list(find_packages(constants.__app_name__, includeRoot=True)),
64         data_files=[
65                 #[[[cog
66                 #       import cog
67                 #       cog.outl('              ("%s", ["data/%%s.desktop" %% constants.__app_name__]),' % desktopFilePath)
68                 #]]]
69                 ("/usr/share/applications", ["data/%s.desktop" % constants.__app_name__]),
70                 #[[[end]]]
71                 ("/usr/share/icons/hicolor/22x22/apps", ["data/icons/22/%s.png" % constants.__app_name__]),
72                 ("/usr/share/icons/hicolor/28x28/apps", ["data/icons/28/%s.png" % constants.__app_name__]),
73                 ("/usr/share/icons/hicolor/32x32/apps", ["data/icons/32/%s.png" % constants.__app_name__]),
74                 ("/usr/share/icons/hicolor/48x48/apps", ["data/icons/48/%s.png" % constants.__app_name__]),
75                 ("/usr/share/icons/hicolor/scalable/apps", ["data/%s.svg" % constants.__app_name__]),
76         ],
77         requires=[
78                 "PySide",
79         ],
80         cmdclass={
81                 'sdist_diablo': sdist_maemo,
82                 'sdist_fremantle': sdist_maemo,
83                 'sdist_harmattan': sdist_maemo,
84         },
85         options={
86                 "sdist_diablo": {
87                         "debian_package": constants.__app_name__,
88                         "Maemo_Display_Name": constants.__pretty_app_name__,
89                         #"Maemo_Upgrade_Description": changes,
90                         "Maemo_Bugtracker": "https://bugs.maemo.org/enter_bug.cgi?product=ejpi",
91                         "Maemo_Icon_26": "data/icons/48/%s.png" % constants.__app_name__,
92                         "MeeGo_Desktop_Entry_Filename": constants.__app_name__,
93                         #"MeeGo_Desktop_Entry": "",
94                         "section": "user/science",
95                         "copyright": "lgpl",
96                         "changelog": changes,
97                         "buildversion": str(constants.__build__),
98                         "depends": "python, python-qt4-core, python-qt4-gui",
99                         "architecture": "any",
100                 },
101                 "sdist_fremantle": {
102                         "debian_package": constants.__app_name__,
103                         "Maemo_Display_Name": constants.__pretty_app_name__,
104                         #"Maemo_Upgrade_Description": changes,
105                         "Maemo_Bugtracker": "https://bugs.maemo.org/enter_bug.cgi?product=ejpi",
106                         "Maemo_Icon_26": "data/icons/48/%s.png" % constants.__app_name__,
107                         "MeeGo_Desktop_Entry_Filename": constants.__app_name__,
108                         #"MeeGo_Desktop_Entry": "",
109                         "section": "user/science",
110                         "copyright": "lgpl",
111                         "changelog": changes,
112                         "buildversion": str(constants.__build__),
113                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-pyside.maemo5",
114                         "architecture": "any",
115                 },
116                 "sdist_harmattan": {
117                         "debian_package": constants.__app_name__,
118                         "Maemo_Display_Name": constants.__pretty_app_name__,
119                         #"Maemo_Upgrade_Description": changes,
120                         "Maemo_Bugtracker": "https://bugs.maemo.org/enter_bug.cgi?product=ejpi",
121                         "Maemo_Icon_26": "data/icons/26/%s.png" % constants.__app_name__,
122                         "MeeGo_Desktop_Entry_Filename": constants.__app_name__,
123                         #"MeeGo_Desktop_Entry": "",
124                         "section": "user/science",
125                         "copyright": "lgpl",
126                         "changelog": changes,
127                         "buildversion": str(constants.__build__),
128                         "depends": "python, python-pyside.qtcore, python-pyside.qtgui",
129                         "architecture": "any",
130                 },
131                 "bdist_rpm": {
132                         "requires": "REPLACEME",
133                         "icon": icon,
134                         "group": "REPLACEME",
135                 },
136         },
137 )