~ubuntu-branches/ubuntu/karmic/zeroinstall-injector/karmic

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Leonard
  • Date: 2009-04-05 10:40:06 UTC
  • mfrom: (1.1.9 upstream) (6.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090405104006-e3x93j5ibvjqu65a
Tags: 0.39-1ubuntu1
* Updated build for Python 2.6.
* FFe: LP: #336317.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
from distutils.command.install import install
5
5
from distutils.command.install_lib import install_lib
6
6
from distutils.command.install_data import install_data
7
 
import os
 
7
import os, subprocess, sys
 
8
import glob
8
9
import zeroinstall
9
10
 
10
11
class build_with_data(build_py):
16
17
                "zeroinstall/0launch-gui/zero-install.glade",
17
18
                "zeroinstall/gtkui/desktop.glade",
18
19
                "zeroinstall/gtkui/cache.glade",
 
20
                "zeroinstall/zerostore/_unlzma",
19
21
        ]
20
22
        def run(self):
21
23
                # Copy .py files and build, as usual
36
38
                launch = os.path.join(self.install_dir, 'zeroinstall/0launch-gui/0launch-gui')
37
39
                os.chmod(launch, os.stat(launch).st_mode | 0111)
38
40
 
 
41
class install_data_locale(install_data):
 
42
        def run(self):
 
43
                self.data_files.extend(self._compile_po_files())
 
44
                install_data.run(self)  # super.run()
 
45
 
 
46
        def _compile_po_files(self):
 
47
                i18nfiles = []
 
48
                for mo in glob.glob("locale/*/LC_MESSAGES/zero-install.mo"):
 
49
                        dest = os.path.dirname(os.path.join('share', mo))
 
50
                        i18nfiles.append((dest, [mo]))
 
51
                return i18nfiles
 
52
 
39
53
# distutils doesn't seem to have any support for adding configuration files.
40
54
# Unfortunately, the freedesktop.org menu spec strangely defines part of the
41
55
# menu definitions as configuration.
47
61
                elif self.prefix == '/usr':
48
62
                        self.__config_dir = os.path.join(self.root or '/', 'etc/xdg')
49
63
                else:
50
 
                        self.__config_dir = os.path.join(self.prefix, 'etc/xdg')
 
64
                        self.__config_dir = os.path.join(self.root or '/', self.prefix[1:], 'etc/xdg')
51
65
 
52
66
        def run(self):
53
67
                install.run(self)       # super.run()
71
85
      cmdclass={
72
86
        'build_py': build_with_data,
73
87
        'install_lib': install_lib_exec,
 
88
        'install_data': install_data_locale,
74
89
        'install': my_install,
75
90
      },
76
91
      long_description="""\