detect harmattan as maemo
[panucci.git] / setup.py
blob5cc2c7804c82b5a0d34bbb42581f840a6bdec2f9
1 #!/usr/bin/env python
3 # This file is part of Panucci.
4 # Copyright (c) 2008-2011 The Panucci Project
6 # Panucci is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Panucci is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Panucci. If not, see <http://www.gnu.org/licenses/>.
19 from distutils.core import setup
21 import glob
22 import os
23 import sys
25 SRC_DIR = 'src/'
27 d2p = lambda d: d[len(SRC_DIR):].replace('/', '.')
28 PACKAGES = [d2p(d) for d, dd, ff in os.walk(SRC_DIR) if '__init__.py' in ff]
30 SCRIPTS = glob.glob('bin/*')
32 if not os.path.exists('data/panucci.service') and 'clean' not in sys.argv:
33 print >>sys.stderr, """
34 data/panucci.service not found. Maybe you want to run
35 "make install" instead of using setup.py directly?
36 """
37 sys.exit(1)
39 DATA_FILES = [
40 ('share/panucci', glob.glob('icons/*.png')),
41 ('share/panucci', glob.glob('data/ui/qml/*')),
42 ('share/panucci', ['data/panucci.conf', 'data/panucci-all.conf', 'data/theme.conf']),
43 ('share/applications', ['data/panucci.desktop']),
44 ('share/icons/hicolor/scalable/apps', ['data/panucci.svg']),
45 ('share/icons/hicolor/64x64/apps', ['data/panucci.png']),
46 ('share/dbus-1/services', ['data/panucci.service']),
49 mo_files = glob.glob('data/locale/*/LC_MESSAGES/panucci.mo')
51 if len(mo_files) == 0:
52 print >>sys.stderr, """
53 Warning: No translation files found. Maybe you want to
54 run "make install" instead of using setup.py directly?
55 """
57 for mofile in mo_files:
58 modir = os.path.dirname(mofile).replace('data', 'share')
59 DATA_FILES.append((modir, [mofile]))
61 sys.path.insert(0, SRC_DIR)
62 import panucci
64 setup(
65 name='panucci',
66 version=panucci.__version__,
67 description='Resuming audiobook and podcast player',
68 author='Thomas Perl',
69 author_email='thp@gpodder.org',
70 url='http://gpodder.org/panucci/',
71 packages=PACKAGES,
72 package_dir={ '': SRC_DIR },
73 scripts=SCRIPTS,
74 data_files=DATA_FILES,