Updated translation templates from source code
[gpodder.git] / setup.py
blobc1c488b9600469e8bdfc80057a0ff4709985b28c
1 #!/usr/bin/env python
4 # gPodder - A media aggregator and podcast client
5 # Copyright (c) 2005-2009 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 from distutils.core import setup
27 # build targets
28 (DEFAULT, MAEMO) = range(2)
30 # import the gpodder module locally for module metadata
31 sys.path.insert(0, 'src')
32 import gpodder
34 # if we are running "setup.py sdist", include all targets (see below)
35 building_source = ('sdist' in sys.argv)
37 # build target
38 if 'TARGET' in os.environ:
39 if os.environ['TARGET'].strip().lower() == 'maemo':
40 target = MAEMO
41 else:
42 target = DEFAULT
44 # search for translations and repare to install
45 translation_files = []
46 for mofile in glob.glob('data/locale/*/LC_MESSAGES/gpodder.mo'):
47 modir = os.path.dirname(mofile).replace('data', 'share')
48 translation_files.append((modir, [mofile]))
50 if not len(translation_files) and not 'clean' in sys.argv:
51 print >>sys.stderr, """
52 Warning: No translation files. (Did you forget to run "make messages"?)
53 """
55 # files to install
56 inst_manpages = glob.glob( 'doc/man/*.1')
57 inst_share_ui = glob.glob('data/ui/*.ui')
58 inst_share_ui_desktop = glob.glob('data/ui/desktop/*.ui')
59 inst_share_ui_maemo = glob.glob('data/ui/maemo/*.ui')
60 inst_share_ui_frmntl = glob.glob('data/ui/frmntl/*.ui')
61 inst_share_gpodder = [ 'data/credits.txt' ]
62 inst_desktop = [ 'data/gpodder.desktop' ]
63 inst_desktop_maemo = [ 'data/maemo/gpodder.desktop' ]
65 inst_icons = [ 'data/gpodder.png' ]
66 inst_icons_64 = [ 'data/icons/64/gpodder.png' ]
67 inst_icons_40 = [ 'data/icons/40/gpodder.png' ]
68 inst_icons_26 = [ 'data/icons/26/gpodder.png' ]
69 inst_icons_24 = [ 'data/icons/24/gpodder.png' ]
70 inst_icons_22 = [ 'data/icons/22/gpodder.png' ]
71 inst_icons_16 = [ 'data/icons/16/gpodder.png' ]
72 inst_icons_svg = [ 'data/gpodder.svg' ]
74 data_files = [
75 ('share/man/man1', inst_manpages),
76 ('share/gpodder/ui', inst_share_ui),
77 ('share/pixmaps', inst_icons),
78 ('share/gpodder', inst_share_gpodder),
81 packages = [
82 'gpodder',
83 'gpodder.gtkui',
84 'gpodder.gtkui.interface',
87 # target-specific installation data files
88 if target == DEFAULT or building_source:
89 data_files += [
90 ('share/gpodder/ui/desktop', inst_share_ui_desktop),
91 ('share/applications', inst_desktop),
92 ('share/icons/hicolor/scalable/apps', inst_icons_svg),
93 ('share/icons/hicolor/48x48/apps', inst_icons),
94 ('share/icons/hicolor/24x24/apps', inst_icons_24),
95 ('share/icons/hicolor/22x22/apps', inst_icons_22),
96 ('share/icons/hicolor/16x16/apps', inst_icons_16),
98 packages += [
99 'gpodder.gtkui.desktop',
101 additional_scripts = []
103 if target == MAEMO or building_source:
104 data_files += [
105 ('share/gpodder/ui/maemo', inst_share_ui_maemo),
106 ('share/gpodder/ui/frmntl', inst_share_ui_frmntl),
107 ('share/applications/hildon', inst_desktop_maemo),
108 ('share/icons/hicolor/scalable/apps', inst_icons_64),
109 ('share/icons/hicolor/40x40/apps', inst_icons_40),
110 ('share/icons/hicolor/26x26/apps', inst_icons_26),
112 packages += [
113 'gpodder.gtkui.maemo',
114 'gpodder.gtkui.frmntl',
116 additional_scripts = [
117 'data/maemo/gpodder-mplayer',
120 author, email = re.match(r'^(.*) <(.*)>$', gpodder.__author__).groups()
122 setup(
123 name = 'gpodder',
124 version = gpodder.__version__,
125 package_dir = { '':'src' },
126 packages = packages,
127 description = 'media aggregator',
128 author = author,
129 author_email = email,
130 url = gpodder.__url__,
131 scripts = glob.glob('bin/*') + additional_scripts,
132 data_files = data_files + translation_files