/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: Vincent Ladeuil
  • Date: 2010-02-24 08:56:08 UTC
  • Revision ID: v.ladeuil+lp@free.fr-20100224085608-ybyx6m452lc5iua2
Open 0.99.0 for development.

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
5
from distutils.core import setup, Command
5
6
from distutils.command.install_data import install_data
 
7
from distutils.command.build import build
6
8
from distutils.dep_util import newer
7
9
from distutils.log import info
8
10
import glob
33
35
        result = runner.run(suite)
34
36
        return result.wasSuccessful()
35
37
 
 
38
 
 
39
class CreateCredits(Command):
 
40
    description = "Create credits file"
 
41
 
 
42
    user_options = [("url=", None, "URL of branch")]
 
43
 
 
44
    def initialize_options(self):
 
45
        self.url = "."
 
46
 
 
47
    def finalize_options(self):
 
48
        pass
 
49
 
 
50
    def get_command_name(self):
 
51
        return 'build_credits'
 
52
 
 
53
    def run(self):
 
54
        from bzrlib.plugin import load_plugins; load_plugins()
 
55
        from bzrlib.branch import Branch
 
56
        from bzrlib.plugins.stats import find_credits
 
57
 
 
58
        import pickle
 
59
 
 
60
        branch = Branch.open(self.url)
 
61
        credits = find_credits(branch.repository, branch.last_revision())
 
62
 
 
63
        pickle.dump(credits, file("credits.pickle", 'w'))
 
64
        return True
 
65
 
 
66
 
 
67
def is_versioned(cmd):
 
68
    from bzrlib.errors import NotBranchError
 
69
    try:
 
70
        from bzrlib.branch import Branch
 
71
        Branch.open(".")
 
72
        return True
 
73
    except NotBranchError:
 
74
        return False
 
75
 
 
76
 
 
77
class BuildData(build):
 
78
    sub_commands = build.sub_commands[:]
 
79
    sub_commands.append(('build_credits', is_versioned))
 
80
 
 
81
 
36
82
class InstallData(install_data):
 
83
 
37
84
    def run(self):
 
85
        import subprocess
38
86
        self.data_files.extend(self._compile_po_files())
39
87
        self.data_files.extend(self._nautilus_plugin())
40
88
        install_data.run(self)
41
89
 
42
90
        try:
43
91
            subprocess.check_call('gtk-update-icon-cache -f -t /usr/share/icons/hicolor')
44
 
        except:
 
92
        except OSError:
45
93
            pass
46
94
 
47
95
    def _compile_po_files(self):
79
127
        files = []
80
128
        if sys.platform[:5] == 'linux':
81
129
            cmd = os.popen('pkg-config --variable=pythondir nautilus-python', 'r')
82
 
            res = cmd.readline()
 
130
            res = cmd.readline().strip()
83
131
            ret = cmd.close()
84
132
            
85
133
            if ret is None:
91
139
 
92
140
setup(
93
141
    name = "bzr-gtk",
94
 
    version = "0.95.0",
 
142
    version = "0.99.0",
95
143
    maintainer = "Jelmer Vernooij",
96
144
    maintainer_email = "jelmer@samba.org",
97
145
    description = "GTK+ Frontends for various Bazaar commands",
98
146
    license = "GNU GPL v2 or later",
99
 
    scripts=['olive-gtk', 'bzr-handle-patch'],
 
147
    scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
 
148
    url = "http://bazaar-vcs.org/BzrGtk",
100
149
    package_dir = {
101
150
        "bzrlib.plugins.gtk": ".",
102
 
        "bzrlib.plugins.gtk.viz": "viz", 
 
151
        "bzrlib.plugins.gtk.viz": "viz",
103
152
        "bzrlib.plugins.gtk.annotate": "annotate",
104
153
        "bzrlib.plugins.gtk.olive": "olive",
105
154
        "bzrlib.plugins.gtk.tests": "tests",
115
164
        "bzrlib.plugins.gtk.branchview",
116
165
        "bzrlib.plugins.gtk.preferences",
117
166
        ],
118
 
    data_files=[('share/olive', ['olive.glade',
119
 
                                 'cmenu.ui',
 
167
    data_files=[('share/olive', ['cmenu.ui',
120
168
                                ]),
121
 
                ('share/olive/icons', ['icons/commit.png',
 
169
                ('share/bzr-gtk', ['credits.pickle']),
 
170
               ('share/bzr-gtk/icons', ['icons/commit.png',
122
171
                                 'icons/commit16.png',
123
172
                                 'icons/diff.png',
124
173
                                 'icons/diff16.png',
129
178
                                 'icons/push.png',
130
179
                                 'icons/push16.png',
131
180
                                 'icons/refresh.png',
132
 
                                 'icons/oliveicon2.png']),
133
 
                ('share/bzr-gtk/icons', ['icons/sign-bad.png',
 
181
                                 'icons/olive-gtk.png',
 
182
                                 'icons/oliveicon2.png',
 
183
                                 'icons/sign-bad.png',
134
184
                                 'icons/sign-ok.png',
135
185
                                 'icons/sign.png',
136
186
                                 'icons/sign-unknown.png',
 
187
                                 'icons/tag-16.png',
137
188
                                 'icons/bug.png',
138
189
                                 'icons/bzr-icon-64.png']),
139
190
                ('share/applications', ['olive-gtk.desktop',
141
192
                                        'bzr-handle-patch.desktop',
142
193
                                        'bzr-notify.desktop']),
143
194
                ('share/application-registry', ['bzr-gtk.applications']),
144
 
                ('share/pixmaps', ['icons/olive-gtk.png', 'icons/bzr-icon-64.png']),
145
 
                ('share/icons/hicolor/scalable/emblems', 
146
 
                    ['icons/emblem-bzr-added.svg', 
147
 
                        'icons/emblem-bzr-conflict.svg', 
148
 
                        'icons/emblem-bzr-controlled.svg', 
 
195
                ('share/pixmaps', ['icons/olive-gtk.png',
 
196
                                   'icons/bzr-icon-64.png']),
 
197
                ('share/icons/hicolor/scalable/emblems',
 
198
                    ['icons/emblem-bzr-added.svg',
 
199
                        'icons/emblem-bzr-conflict.svg',
 
200
                        'icons/emblem-bzr-controlled.svg',
149
201
                        'icons/emblem-bzr-modified.svg',
150
 
                        'icons/emblem-bzr-removed.svg'])
 
202
                        'icons/emblem-bzr-removed.svg',
 
203
                        'icons/emblem-bzr-ignored.svg'])
151
204
               ],
152
205
    cmdclass={'install_data': InstallData,
 
206
              'build_credits': CreateCredits,
 
207
              'build': BuildData,
153
208
              'check': Check}
154
209
)