gPodder 3.0.0 "397/D" released
[gpodder.git] / setup.py
blob897646307baea1d44be710975fdf558ae7678c75
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_examples = glob.glob('examples/*')
79 inst_desktop = [ DESKTOP_FILE ]
80 inst_share_dbus_services = [ DBUS_SERVICE_FILE ]
82 inst_icons = [ 'data/gpodder.png' ]
83 inst_icons_64 = [ 'data/icons/64/gpodder.png' ]
84 inst_icons_40 = [ 'data/icons/40/gpodder.png' ]
85 inst_icons_32 = [ 'data/icons/32/gpodder.png' ]
86 inst_icons_26 = [ 'data/icons/26/gpodder.png' ]
87 inst_icons_24 = [ 'data/icons/24/gpodder.png' ]
88 inst_icons_22 = [ 'data/icons/22/gpodder.png' ]
89 inst_icons_16 = [ 'data/icons/16/gpodder.png' ]
90 inst_icons_svg = [ 'data/gpodder.svg' ]
92 data_files = [
93 ('share/man/man1', inst_manpages),
94 ('share/gpodder/ui', inst_share_ui),
95 ('share/gpodder/ui/qml', inst_share_ui_qml),
96 ('share/gpodder/ui/qml/artwork', inst_share_ui_qml_artwork),
97 ('share/gpodder/ui/qml/test', inst_share_ui_qml_test),
98 ('share/pixmaps', inst_icons),
99 ('share/gpodder', inst_share_gpodder),
100 ('share/gpodder/examples', inst_share_gpodder_examples),
101 ('share/dbus-1/services',inst_share_dbus_services),
104 packages = [
105 'gpodder',
106 'gpodder.plugins',
107 'gpodder.gtkui',
108 'gpodder.gtkui.interface',
109 'gpodder.webui',
110 'gpodder.qmlui',
113 data_files += [
114 ('share/gpodder/ui/desktop', inst_share_ui_desktop),
115 ('share/applications', inst_desktop),
116 ('share/icons/hicolor/scalable/apps', inst_icons_svg),
117 ('share/icons/hicolor/48x48/apps', inst_icons),
118 ('share/icons/hicolor/24x24/apps', inst_icons_24),
119 ('share/icons/hicolor/22x22/apps', inst_icons_22),
120 ('share/icons/hicolor/16x16/apps', inst_icons_16),
122 packages += [
123 'gpodder.gtkui.desktop',
126 author, email = re.match(r'^(.*) <(.*)>$', gpodder.__author__).groups()
128 setup(
129 name = 'gpodder',
130 version = gpodder.__version__,
131 package_dir = { '':'src' },
132 packages = packages,
133 description = 'Media aggregator and podcast client',
134 author = author,
135 author_email = email,
136 url = gpodder.__url__,
137 scripts = glob.glob('bin/*'),
138 data_files = data_files + translation_files