~diwic/apport/trunk

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Martin Pitt
  • Date: 2009-06-27 17:49:43 UTC
  • mto: (1369.12.1 credentials-api)
  • mto: This revision was merged to the branch mainline in revision 1457.
  • Revision ID: martin.pitt@canonical.com-20090627174943-12jxgkkykl3efgbh
throw away complicated and incomplete build system, use DistUtilsExtra.auto

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
 
from distutils.core import setup
4
 
import distutils.command.install_data
5
 
import distutils.command.clean
6
 
from distutils.dir_util import remove_tree
7
 
 
8
 
import subprocess, glob, os.path
9
 
 
10
 
class my_install_data(distutils.command.install_data.install_data):
11
 
    def run(self):
12
 
        # install files from etc/
13
 
        for (root, _, files) in os.walk('etc'):
14
 
            self.data_files.append((os.path.join('/', root), 
15
 
                    [os.path.join(root, f) for f in files]))
16
 
 
17
 
        # build gettext *.mo
18
 
        subprocess.call(['make', '-C', 'po', 'build-mo'])
19
 
        for filepath in glob.glob('po/mo/*/LC_MESSAGES/*.mo'):
20
 
            lang = filepath[len('po/mo/'):]
21
 
            targetpath = os.path.dirname(os.path.join('share/locale',lang))
22
 
            self.data_files.append((targetpath, [filepath]))
23
 
 
24
 
        distutils.command.install_data.install_data.run(self)
25
 
 
26
 
        # symlinks
27
 
        d = os.path.join(self.install_dir, 'share', 'icons', 'hicolor', 'scalable',
28
 
                'mimetypes')
29
 
        self.mkpath(d)
30
 
        l = os.path.join (d, 'text-x-apport.svg')
31
 
        if os.path.exists(l):
32
 
            os.unlink(l)
33
 
        os.symlink(os.path.join('..', 'apps', 'apport.svg'), l)
34
 
 
35
 
class my_clean(distutils.command.clean.clean):
36
 
    def run(self):
37
 
        distutils.command.clean.clean.run(self)
38
 
 
39
 
        # clean po/mo
40
 
        modir = os.path.join('po', 'mo')
41
 
        if os.path.exists(modir):
42
 
            remove_tree(modir, self.dry_run)
43
 
 
44
 
setup(name='apport',
 
3
from glob import glob
 
4
 
 
5
try:
 
6
    import DistUtilsExtra.auto
 
7
except ImportError:
 
8
    import sys
 
9
    print >> sys.stderr, 'To build Apport you need https://launchpad.net/python-distutils-extra'
 
10
    sys.exit(1)
 
11
 
 
12
assert DistUtilsExtra.auto.__version__ >= '2.2', 'needs DistUtilsExtra.auto >= 2.2'
 
13
 
 
14
DistUtilsExtra.auto.setup(name='apport',
45
15
      author='Martin Pitt',
46
16
      author_email='martin.pitt@ubuntu.com',
47
 
      maintainer='Martin Pitt',
48
 
      maintainer_email='martin.pitt@ubuntu.com',
49
17
      url='https://wiki.ubuntu.com/Apport',
50
18
      license='gpl',
51
19
      description='intercept, process, and report crashes and bug reports',
52
20
      version='1.4',
53
 
      py_modules=['problem_report', 'apport_python_hook'],
54
 
      data_files=[('share/apport', ['gtk/apport-gtk.ui'] + glob.glob('kde/*.ui')),
55
 
                  ('share/icons/hicolor/scalable/apps', ['apport/apport.svg']),
56
 
                  ('share/mime/packages', glob.glob('xdg-mime/*')),
 
21
 
 
22
      data_files=[('share/mime/packages', glob('xdg-mime/*')),
 
23
                  ('share/apport', glob('kde/*.ui')), #TODO: use pykdeuic modules
57
24
                  ('share/apport/testsuite/', ['test-apport', 'test-hooks', 'run-tests']),
58
 
                  ('share/doc/apport/', glob.glob('doc/*.txt') + glob.glob('doc/*.pdf')),
59
 
                  ('share/apport/package-hooks/', glob.glob('package-hooks/*')),
60
 
                  ('share/apport/general-hooks/', glob.glob('general-hooks/*')),
 
25
                  ('share/doc/apport/', glob('doc/*.txt')),
61
26
                  ],
62
 
      scripts=['bin/apport', 'bin/apport-checkreports', 'bin/apport-retrace',
63
 
          'bin/apport-unpack', 'bin/package_hook',
64
 
          'bin/kernel_crashdump', 'bin/gcc_ice_hook', 'gtk/apport-gtk',
65
 
          'kde/apport-kde', 'cli/apport-cli', 'bin/dupdb-admin',
66
 
          'bin/kernel_oops', 'bin/apportcheckresume'],
67
 
      packages=['apport', 'apport.crashdb_impl'],
68
 
 
69
 
      cmdclass = { 
70
 
          'install_data': my_install_data,
71
 
          'clean': my_clean,
72
 
      },
 
27
      scripts=['gtk/apport-gtk', 'kde/apport-kde', 'cli/apport-cli'],
73
28
)