/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: Curtis Hovey
  • Date: 2012-02-05 05:14:11 UTC
  • mto: This revision was merged to the branch mainline in revision 775.
  • Revision ID: sinzui.is@verizon.net-20120205051411-y9ra08wae1wsfv52
Remove unneeded gtksourceview1 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
 
 
3
2
"""GTK+ Frontends for various Bazaar commands."""
4
3
 
 
4
from info import *
 
5
 
5
6
from distutils.core import setup, Command
6
7
from distutils.command.install_data import install_data
7
8
from distutils.command.build import build
8
 
from distutils.dep_util import newer
9
 
from distutils.log import info
10
 
import glob
 
9
from distutils.command.sdist import sdist
 
10
try:
 
11
    from DistUtilsExtra.command import *
 
12
except ImportError:
 
13
   # Python distutils extra is not available.
 
14
    class cmd_build_i18n(Command):
 
15
        def run(self):
 
16
            print >> sys.stderr, "For internationalization support you'll need to install https://launchpad.net/python-distutils-extra"
 
17
else:
 
18
    # Use build_i18n from DistUtilsExtra
 
19
    cmd_build_i18n = build_i18n.build_i18n
 
20
 
11
21
import os
12
22
import sys
13
23
 
27
37
 
28
38
    def run(self):
29
39
        from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
30
 
        import __init__ as bzrgtk
 
40
        from bzrlib.plugin import PluginImporter
 
41
        PluginImporter.specific_paths["bzrlib.plugins.gtk"] = os.path.dirname(__file__)
 
42
        from bzrlib.plugins.gtk.tests import load_tests
 
43
        suite = TestSuite()
 
44
        loader = TestLoader()
 
45
        load_tests(suite, None, loader)
31
46
        runner = TextTestRunner()
32
 
        loader = TestLoader()
33
 
        suite = TestSuite()
34
 
        suite.addTest(bzrgtk.test_suite())
35
47
        result = runner.run(suite)
36
48
        return result.wasSuccessful()
37
49
 
53
65
    def run(self):
54
66
        from bzrlib.plugin import load_plugins; load_plugins()
55
67
        from bzrlib.branch import Branch
56
 
        from bzrlib.plugins.stats import find_credits
 
68
        from bzrlib.plugins.stats.cmds import find_credits
57
69
 
58
70
        import pickle
59
71
 
79
91
    sub_commands.append(('build_credits', is_versioned))
80
92
 
81
93
 
 
94
class SourceDist(sdist):
 
95
    sub_commands = sdist.sub_commands[:]
 
96
    sub_commands.append(('build_credits', is_versioned))
 
97
 
 
98
 
82
99
class InstallData(install_data):
83
100
 
84
101
    def run(self):
85
102
        import subprocess
86
 
        self.data_files.extend(self._compile_po_files())
87
103
        self.data_files.extend(self._nautilus_plugin())
88
104
        install_data.run(self)
89
105
 
93
109
        except OSError:
94
110
            pass
95
111
 
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
 
 
126
112
    def _nautilus_plugin(self):
127
113
        files = []
128
114
        if sys.platform[:5] == 'linux':
137
123
 
138
124
 
139
125
if __name__ == '__main__':
 
126
    version = bzr_plugin_version[:3]
 
127
    version_string = ".".join([str(x) for x in version])
140
128
    setup(
141
129
        name = "bzr-gtk",
142
 
        version = "0.99.0",
 
130
        version = version_string,
143
131
        maintainer = "Jelmer Vernooij",
144
132
        maintainer_email = "jelmer@samba.org",
145
133
        description = "GTK+ Frontends for various Bazaar commands",
146
134
        license = "GNU GPL v2 or later",
147
 
        scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
 
135
        scripts = ['bzr-handle-patch', 'bzr-notify'],
148
136
        url = "http://bazaar-vcs.org/BzrGtk",
149
137
        package_dir = {
150
138
            "bzrlib.plugins.gtk": ".",
151
139
            "bzrlib.plugins.gtk.viz": "viz",
152
140
            "bzrlib.plugins.gtk.annotate": "annotate",
153
 
            "bzrlib.plugins.gtk.olive": "olive",
154
141
            "bzrlib.plugins.gtk.tests": "tests",
155
142
            "bzrlib.plugins.gtk.branchview": "branchview",
156
143
            "bzrlib.plugins.gtk.preferences": "preferences",
159
146
            "bzrlib.plugins.gtk",
160
147
            "bzrlib.plugins.gtk.viz",
161
148
            "bzrlib.plugins.gtk.annotate",
162
 
            "bzrlib.plugins.gtk.olive",
163
149
            "bzrlib.plugins.gtk.tests",
164
150
            "bzrlib.plugins.gtk.branchview",
165
151
            "bzrlib.plugins.gtk.preferences",
166
152
        ],
167
 
        data_files=[('share/olive', ['cmenu.ui',
168
 
                                     ]),
169
 
                    ('share/bzr-gtk', ['credits.pickle']),
 
153
        data_files=[ ('share/bzr-gtk', ['credits.pickle']),
170
154
                    ('share/bzr-gtk/icons', ['icons/commit.png',
171
155
                                             'icons/commit16.png',
172
156
                                             'icons/diff.png',
178
162
                                             'icons/push.png',
179
163
                                             'icons/push16.png',
180
164
                                             'icons/refresh.png',
181
 
                                             'icons/olive-gtk.png',
182
 
                                             'icons/oliveicon2.png',
183
165
                                             'icons/sign-bad.png',
184
166
                                             'icons/sign-ok.png',
185
167
                                             'icons/sign.png',
187
169
                                             'icons/tag-16.png',
188
170
                                             'icons/bug.png',
189
171
                                             'icons/bzr-icon-64.png']),
190
 
                    ('share/applications', ['olive-gtk.desktop',
191
 
                                            'bazaar-properties.desktop',
 
172
                    # In case Python distutils extra is not available,
 
173
                    # install the .desktop files
 
174
                    ('share/applications', ['bazaar-properties.desktop',
192
175
                                            'bzr-handle-patch.desktop',
193
176
                                            'bzr-notify.desktop']),
194
177
                    ('share/application-registry', ['bzr-gtk.applications']),
195
 
                    ('share/pixmaps', ['icons/olive-gtk.png',
196
 
                                       'icons/bzr-icon-64.png']),
 
178
                    ('share/pixmaps', ['icons/bzr-icon-64.png']),
 
179
                    ('share/icons/hicolor/scalable/apps', ['icons/bzr-panel.svg']),
197
180
                    ('share/icons/hicolor/scalable/emblems',
198
181
                     ['icons/emblem-bzr-added.svg',
199
182
                      'icons/emblem-bzr-conflict.svg',
205
188
        cmdclass={'install_data': InstallData,
206
189
                  'build_credits': CreateCredits,
207
190
                  'build': BuildData,
 
191
                  'build_i18n': cmd_build_i18n,
 
192
                  'sdist': SourceDist,
208
193
                  'check': Check}
209
194
        )