/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Jelmer Vernooij
  • Date: 2010-06-04 12:25:04 UTC
  • mfrom: (689.1.1 return-creds)
  • Revision ID: jelmer@samba.org-20100604122504-xe291u8la5uur0ij
Merge credentials fix from John.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
 
2
 
2
3
"""GTK+ Frontends for various Bazaar commands."""
3
4
 
4
 
from info import *
5
 
 
6
5
from distutils.core import setup, Command
7
6
from distutils.command.install_data import install_data
8
7
from distutils.command.build import build
 
8
from distutils.dep_util import newer
 
9
from distutils.log import info
 
10
import glob
9
11
import os
10
12
import sys
11
13
 
51
53
    def run(self):
52
54
        from bzrlib.plugin import load_plugins; load_plugins()
53
55
        from bzrlib.branch import Branch
54
 
        from bzrlib.plugins.stats.cmds import find_credits
 
56
        from bzrlib.plugins.stats import find_credits
55
57
 
56
58
        import pickle
57
59
 
81
83
 
82
84
    def run(self):
83
85
        import subprocess
 
86
        self.data_files.extend(self._compile_po_files())
84
87
        self.data_files.extend(self._nautilus_plugin())
85
88
        install_data.run(self)
86
89
 
90
93
        except OSError:
91
94
            pass
92
95
 
 
96
    def _compile_po_files(self):
 
97
        data_files = []
 
98
 
 
99
        # Don't install language files on Win32
 
100
        if sys.platform == 'win32':
 
101
            return data_files
 
102
 
 
103
        PO_DIR = 'po'
 
104
        for po in glob.glob(os.path.join(PO_DIR,'*.po')):
 
105
            lang = os.path.basename(po[:-3])
 
106
            # It's necessary to compile in this directory (not in po_dir)
 
107
            # because install_data can't rename file
 
108
            mo = os.path.join('build', 'mo', lang, 'olive-gtk.mo')
 
109
 
 
110
            directory = os.path.dirname(mo)
 
111
            if not os.path.exists(directory):
 
112
                info('creating %s' % directory)
 
113
                os.makedirs(directory)
 
114
            if newer(po, mo):
 
115
                # True if mo doesn't exist
 
116
                cmd = 'msgfmt -o %s %s' % (mo, po)
 
117
                info('compiling %s -> %s' % (po, mo))
 
118
                if os.system(cmd) != 0:
 
119
                    raise SystemExit('Error while running msgfmt')
 
120
                dest = os.path.dirname(
 
121
                    os.path.join('share', 'locale', lang,
 
122
                                 'LC_MESSAGES', 'olive-gtk.mo'))
 
123
                data_files.append((dest, [mo]))
 
124
        return data_files
 
125
 
93
126
    def _nautilus_plugin(self):
94
127
        files = []
95
128
        if sys.platform[:5] == 'linux':
104
137
 
105
138
 
106
139
if __name__ == '__main__':
107
 
    version = bzr_plugin_version[:3]
108
 
    version_string = ".".join([str(x) for x in version])
109
140
    setup(
110
141
        name = "bzr-gtk",
111
 
        version = version_string,
 
142
        version = "0.99.0",
112
143
        maintainer = "Jelmer Vernooij",
113
144
        maintainer_email = "jelmer@samba.org",
114
145
        description = "GTK+ Frontends for various Bazaar commands",
115
146
        license = "GNU GPL v2 or later",
116
 
        scripts = ['bzr-handle-patch', 'bzr-notify'],
 
147
        scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
117
148
        url = "http://bazaar-vcs.org/BzrGtk",
118
149
        package_dir = {
119
150
            "bzrlib.plugins.gtk": ".",
120
151
            "bzrlib.plugins.gtk.viz": "viz",
121
152
            "bzrlib.plugins.gtk.annotate": "annotate",
 
153
            "bzrlib.plugins.gtk.olive": "olive",
122
154
            "bzrlib.plugins.gtk.tests": "tests",
123
155
            "bzrlib.plugins.gtk.branchview": "branchview",
124
156
            "bzrlib.plugins.gtk.preferences": "preferences",
127
159
            "bzrlib.plugins.gtk",
128
160
            "bzrlib.plugins.gtk.viz",
129
161
            "bzrlib.plugins.gtk.annotate",
 
162
            "bzrlib.plugins.gtk.olive",
130
163
            "bzrlib.plugins.gtk.tests",
131
164
            "bzrlib.plugins.gtk.branchview",
132
165
            "bzrlib.plugins.gtk.preferences",
133
166
        ],
134
 
        data_files=[ ('share/bzr-gtk', ['credits.pickle']),
 
167
        data_files=[('share/olive', ['cmenu.ui',
 
168
                                     ]),
 
169
                    ('share/bzr-gtk', ['credits.pickle']),
135
170
                    ('share/bzr-gtk/icons', ['icons/commit.png',
136
171
                                             'icons/commit16.png',
137
172
                                             'icons/diff.png',
143
178
                                             'icons/push.png',
144
179
                                             'icons/push16.png',
145
180
                                             'icons/refresh.png',
 
181
                                             'icons/olive-gtk.png',
 
182
                                             'icons/oliveicon2.png',
146
183
                                             'icons/sign-bad.png',
147
184
                                             'icons/sign-ok.png',
148
185
                                             'icons/sign.png',
150
187
                                             'icons/tag-16.png',
151
188
                                             'icons/bug.png',
152
189
                                             'icons/bzr-icon-64.png']),
153
 
                    ('share/applications', ['bazaar-properties.desktop',
 
190
                    ('share/applications', ['olive-gtk.desktop',
 
191
                                            'bazaar-properties.desktop',
154
192
                                            'bzr-handle-patch.desktop',
155
193
                                            'bzr-notify.desktop']),
156
194
                    ('share/application-registry', ['bzr-gtk.applications']),
157
 
                    ('share/pixmaps', ['icons/bzr-icon-64.png']),
 
195
                    ('share/pixmaps', ['icons/olive-gtk.png',
 
196
                                       'icons/bzr-icon-64.png']),
158
197
                    ('share/icons/hicolor/scalable/emblems',
159
198
                     ['icons/emblem-bzr-added.svg',
160
199
                      'icons/emblem-bzr-conflict.svg',