gPodder 2.950.14 for Harmattan
[gpodder.git] / setup.py
blob1eb78a90630629dfd812d2e9e1e2ad5a790b947b
1 #!/usr/bin/env python
4 # gPodder - A media aggregator and podcast client
5 # Copyright (c) 2005-2011 Thomas Perl and the gPodder Team
7 # gPodder is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # gPodder is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import glob
22 import os
23 import re
24 import sys
25 import subprocess
26 from distutils.core import setup
28 # import the gpodder module locally for module metadata
29 sys.path.insert(0, 'src')
30 import gpodder
32 # if we are running "setup.py sdist", include all targets (see below)
33 building_source = ('sdist' in sys.argv)
34 cleaning_target = ('clean' in sys.argv)
36 # Ignore missing files if we are in clean or sdist mode
37 ignore_missing = (building_source or cleaning_target)
39 # search for translations, taking $LINGUAS into account
40 translation_files = []
41 linguas = os.environ.get('LINGUAS', None)
42 if linguas is not None:
43 linguas = linguas.split()
45 for mofile in glob.glob('data/locale/*/LC_MESSAGES/gpodder.mo'):
46 _, _, lang, _ = mofile.split('/', 3)
48 # Only install if either $LINGUAS it not set or the
49 # language is specified in the $LINGUAS variable
50 if linguas is None or lang in linguas:
51 modir = os.path.dirname(mofile).replace('data', 'share')
52 translation_files.append((modir, [mofile]))
54 if not len(translation_files) and \
55 not ignore_missing and \
56 linguas not in (None, []):
57 print >>sys.stderr, """
58 Warning: No translation files. (Did you forget to run "make messages"?)
59 """
61 DBUS_SERVICE_FILE = 'data/org.gpodder.service'
62 DESKTOP_FILE = 'data/gpodder.desktop'
64 for prerequisite in (DBUS_SERVICE_FILE, DESKTOP_FILE):
65 if not os.path.exists(prerequisite) and not ignore_missing:
66 print >>sys.stderr, 'Missing file:', prerequisite
67 print >>sys.stderr, 'Use "make install" if you want to install.'
68 sys.exit(1)
70 # files to install
71 inst_manpages = glob.glob( 'data/man/*.1')
72 inst_share_ui = glob.glob('data/ui/*.ui')
73 inst_share_ui_desktop = glob.glob('data/ui/desktop/*.ui')
74 inst_share_ui_qml = glob.glob('data/ui/qml/*.qml') + glob.glob('data/ui/qml/*.js')
75 inst_share_ui_qml_artwork = glob.glob('data/ui/qml/artwork/*')
76 inst_share_ui_qml_test = glob.glob('data/ui/qml/test/*')
77 inst_share_gpodder = [ 'data/credits.txt' ] + glob.glob('data/images/*.png')
78 inst_share_gpodder += glob.glob('data/images/*.jpg') # Harmattan splash screens
79 inst_share_gpodder_examples = glob.glob('examples/*')
80 inst_desktop = [ DESKTOP_FILE ]
81 inst_share_dbus_services = [ DBUS_SERVICE_FILE ]
83 inst_icons = [ 'data/gpodder.png' ]
84 inst_icons_64 = [ 'data/icons/64/gpodder.png' ]
85 inst_icons_40 = [ 'data/icons/40/gpodder.png' ]
86 inst_icons_32 = [ 'data/icons/32/gpodder.png' ]
87 inst_icons_26 = [ 'data/icons/26/gpodder.png' ]
88 inst_icons_24 = [ 'data/icons/24/gpodder.png' ]
89 inst_icons_22 = [ 'data/icons/22/gpodder.png' ]
90 inst_icons_16 = [ 'data/icons/16/gpodder.png' ]
91 inst_icons_svg = [ 'data/gpodder.svg' ]
93 data_files = [
94 ('share/man/man1', inst_manpages),
95 ('share/gpodder/ui', inst_share_ui),
96 ('share/gpodder/ui/qml', inst_share_ui_qml),
97 ('share/gpodder/ui/qml/artwork', inst_share_ui_qml_artwork),
98 ('share/gpodder/ui/qml/test', inst_share_ui_qml_test),
99 ('share/pixmaps', inst_icons),
100 ('share/gpodder', inst_share_gpodder),
101 ('share/gpodder/examples', inst_share_gpodder_examples),
102 ('share/dbus-1/services',inst_share_dbus_services),
105 packages = [
106 'gpodder',
107 'gpodder.plugins',
108 'gpodder.gtkui',
109 'gpodder.gtkui.interface',
110 'gpodder.webui',
111 'gpodder.qmlui',
112 'mygpoclient',
115 data_files += [
116 ('share/gpodder/ui/desktop', inst_share_ui_desktop),
117 ('share/applications', inst_desktop),
118 ('share/icons/hicolor/scalable/apps', inst_icons_svg),
119 ('share/icons/hicolor/48x48/apps', inst_icons),
120 ('share/icons/hicolor/24x24/apps', inst_icons_24),
121 ('share/icons/hicolor/22x22/apps', inst_icons_22),
122 ('share/icons/hicolor/16x16/apps', inst_icons_16),
124 packages += [
125 'gpodder.gtkui.desktop',
128 author, email = re.match(r'^(.*) <(.*)>$', gpodder.__author__).groups()
130 setup(
131 name = 'gpodder',
132 version = gpodder.__version__,
133 package_dir = { '':'src' },
134 packages = packages,
135 description = 'A media aggregator and podcast client',
136 author = author,
137 author_email = email,
138 url = gpodder.__url__,
139 scripts = glob.glob('bin/*'),
140 data_files = data_files + translation_files