/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: 2011-02-18 13:01:03 UTC
  • Revision ID: jelmer@samba.org-20110218130103-fiyk203auk28thpn
Remove some unused imports, fix some formatting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
"""GTK+ Frontends for various Bazaar commands."""
3
3
 
4
 
import os
5
 
import sys
6
 
 
7
 
from info import bzr_plugin_version
 
4
from info import *
8
5
 
9
6
from distutils.core import setup, Command
10
7
from distutils.command.install_data import install_data
11
8
from distutils.command.build import build
12
 
from distutils.command.sdist import sdist
13
 
try:
14
 
    from DistUtilsExtra.command import build_i18n
15
 
except ImportError:
16
 
    # Python distutils extra is not available.
17
 
    class cmd_build_i18n(build):
18
 
        user_options = []
19
 
 
20
 
        def initialize_options(self):
21
 
            self.domain = None
22
 
            self.desktop_files = None
23
 
 
24
 
        def finalize_options(self):
25
 
            pass
26
 
 
27
 
        def run(self):
28
 
            print >> sys.stderr, (
29
 
                "For internationalization support you'll need to install "
30
 
                "https://launchpad.net/python-distutils-extra")
31
 
else:
32
 
    # Use build_i18n from DistUtilsExtra
33
 
    cmd_build_i18n = build_i18n.build_i18n
34
 
 
 
9
import os
 
10
import sys
35
11
 
36
12
class Check(Command):
37
13
    description = "Run unit tests"
38
14
 
39
 
    user_options = [
40
 
        ('module=', 'm', 'The test module to run'),
41
 
        ]
 
15
    user_options = []
42
16
 
43
17
    def initialize_options(self):
44
 
        self.module = None
 
18
        pass
45
19
 
46
20
    def finalize_options(self):
47
21
        pass
51
25
 
52
26
    def run(self):
53
27
        from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
54
 
        from bzrlib.plugin import PluginImporter
55
 
        PluginImporter.specific_paths["bzrlib.plugins.gtk"] = os.path.dirname(
56
 
            __file__)
57
 
        from bzrlib.plugins.gtk.tests import load_tests
 
28
        import __init__ as bzrgtk
 
29
        runner = TextTestRunner()
 
30
        loader = TestLoader()
58
31
        suite = TestSuite()
59
 
        loader = TestLoader()
60
 
        load_tests(suite, self.module, loader)
61
 
        runner = TextTestRunner()
 
32
        suite.addTest(bzrgtk.test_suite())
62
33
        result = runner.run(suite)
63
34
        return result.wasSuccessful()
64
35
 
78
49
        return 'build_credits'
79
50
 
80
51
    def run(self):
81
 
        from bzrlib.plugin import load_plugins
82
 
        load_plugins()
 
52
        from bzrlib.plugin import load_plugins; load_plugins()
83
53
        from bzrlib.branch import Branch
84
54
        from bzrlib.plugins.stats.cmds import find_credits
85
55
 
107
77
    sub_commands.append(('build_credits', is_versioned))
108
78
 
109
79
 
110
 
class SourceDist(sdist):
111
 
    sub_commands = sdist.sub_commands[:]
112
 
    sub_commands.append(('build_credits', is_versioned))
113
 
 
114
 
 
115
80
class InstallData(install_data):
116
81
 
117
82
    def run(self):
142
107
    version = bzr_plugin_version[:3]
143
108
    version_string = ".".join([str(x) for x in version])
144
109
    setup(
145
 
        name="bzr-gtk",
146
 
        version=version_string,
147
 
        maintainer="Jelmer Vernooij",
148
 
        maintainer_email="jelmer@samba.org",
149
 
        description="GTK+ Frontends for various Bazaar commands",
150
 
        license="GNU GPL v2 or later",
151
 
        scripts=['bzr-handle-patch'],
152
 
        url="http://bazaar-vcs.org/BzrGtk",
153
 
        package_dir={
 
110
        name = "bzr-gtk",
 
111
        version = version_string,
 
112
        maintainer = "Jelmer Vernooij",
 
113
        maintainer_email = "jelmer@samba.org",
 
114
        description = "GTK+ Frontends for various Bazaar commands",
 
115
        license = "GNU GPL v2 or later",
 
116
        scripts = ['bzr-handle-patch', 'bzr-notify'],
 
117
        url = "http://bazaar-vcs.org/BzrGtk",
 
118
        package_dir = {
154
119
            "bzrlib.plugins.gtk": ".",
155
120
            "bzrlib.plugins.gtk.viz": "viz",
156
121
            "bzrlib.plugins.gtk.annotate": "annotate",
158
123
            "bzrlib.plugins.gtk.branchview": "branchview",
159
124
            "bzrlib.plugins.gtk.preferences": "preferences",
160
125
            },
161
 
        packages=[
 
126
        packages = [
162
127
            "bzrlib.plugins.gtk",
163
128
            "bzrlib.plugins.gtk.viz",
164
129
            "bzrlib.plugins.gtk.annotate",
166
131
            "bzrlib.plugins.gtk.branchview",
167
132
            "bzrlib.plugins.gtk.preferences",
168
133
        ],
169
 
        data_files=[('share/bzr-gtk', ['credits.pickle']),
 
134
        data_files=[ ('share/bzr-gtk', ['credits.pickle']),
170
135
                    ('share/bzr-gtk/icons', ['icons/commit.png',
171
136
                                             'icons/commit16.png',
172
137
                                             'icons/diff.png',
185
150
                                             'icons/tag-16.png',
186
151
                                             'icons/bug.png',
187
152
                                             'icons/bzr-icon-64.png']),
188
 
                    # In case Python distutils extra is not available,
189
 
                    # install the .desktop files
190
153
                    ('share/applications', ['bazaar-properties.desktop',
191
 
                                            'bzr-handle-patch.desktop']),
 
154
                                            'bzr-handle-patch.desktop',
 
155
                                            'bzr-notify.desktop']),
192
156
                    ('share/application-registry', ['bzr-gtk.applications']),
193
157
                    ('share/pixmaps', ['icons/bzr-icon-64.png']),
194
 
                    ('share/icons/hicolor/scalable/apps',
195
 
                        ['icons/bzr-panel.svg']),
 
158
                    ('share/icons/hicolor/scalable/apps', ['icons/bzr-panel.svg']),
196
159
                    ('share/icons/hicolor/scalable/emblems',
197
160
                     ['icons/emblem-bzr-added.svg',
198
161
                      'icons/emblem-bzr-conflict.svg',
204
167
        cmdclass={'install_data': InstallData,
205
168
                  'build_credits': CreateCredits,
206
169
                  'build': BuildData,
207
 
                  'build_i18n': cmd_build_i18n,
208
 
                  'sdist': SourceDist,
209
170
                  'check': Check}
210
171
        )