3
"""GTK+ Frontends for various Bazaar commands."""
5
from distutils.core import setup, Command
6
from distutils.command.install_data import install_data
7
from distutils.command.build import build
12
description = "Run unit tests"
16
def initialize_options(self):
19
def finalize_options(self):
22
def get_command_name(self):
26
from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
27
import __init__ as bzrgtk
28
runner = TextTestRunner()
31
suite.addTest(bzrgtk.test_suite())
32
result = runner.run(suite)
33
return result.wasSuccessful()
36
class CreateCredits(Command):
37
description = "Create credits file"
39
user_options = [("url=", None, "URL of branch")]
41
def initialize_options(self):
44
def finalize_options(self):
47
def get_command_name(self):
48
return 'build_credits'
51
from bzrlib.plugin import load_plugins; load_plugins()
52
from bzrlib.branch import Branch
53
from bzrlib.plugins.stats import find_credits
57
branch = Branch.open(self.url)
58
credits = find_credits(branch.repository, branch.last_revision())
60
pickle.dump(credits, file("credits.pickle", 'w'))
64
def is_versioned(cmd):
65
from bzrlib.errors import NotBranchError
67
from bzrlib.branch import Branch
70
except NotBranchError:
74
class BuildData(build):
75
sub_commands = build.sub_commands[:]
76
sub_commands.append(('build_credits', is_versioned))
79
class InstallData(install_data):
83
self.data_files.extend(self._nautilus_plugin())
84
install_data.run(self)
87
subprocess.check_call('gtk-update-icon-cache '
88
'-f -t /usr/share/icons/hicolor')
92
def _nautilus_plugin(self):
94
if sys.platform[:5] == 'linux':
95
cmd = os.popen('pkg-config --variable=pythondir nautilus-python',
97
res = cmd.readline().strip()
101
files.append((dest, ['nautilus-bzr.py']))
105
if __name__ == '__main__':
109
maintainer = "Jelmer Vernooij",
110
maintainer_email = "jelmer@samba.org",
111
description = "GTK+ Frontends for various Bazaar commands",
112
license = "GNU GPL v2 or later",
113
scripts = ['bzr-handle-patch', 'bzr-notify'],
114
url = "http://bazaar-vcs.org/BzrGtk",
116
"bzrlib.plugins.gtk": ".",
117
"bzrlib.plugins.gtk.viz": "viz",
118
"bzrlib.plugins.gtk.annotate": "annotate",
119
"bzrlib.plugins.gtk.tests": "tests",
120
"bzrlib.plugins.gtk.branchview": "branchview",
121
"bzrlib.plugins.gtk.preferences": "preferences",
124
"bzrlib.plugins.gtk",
125
"bzrlib.plugins.gtk.viz",
126
"bzrlib.plugins.gtk.annotate",
127
"bzrlib.plugins.gtk.tests",
128
"bzrlib.plugins.gtk.branchview",
129
"bzrlib.plugins.gtk.preferences",
131
data_files=[ ('share/bzr-gtk', ['credits.pickle']),
132
('share/bzr-gtk/icons', ['icons/commit.png',
133
'icons/commit16.png',
143
'icons/sign-bad.png',
146
'icons/sign-unknown.png',
149
'icons/bzr-icon-64.png']),
150
('share/applications', ['bazaar-properties.desktop',
151
'bzr-handle-patch.desktop',
152
'bzr-notify.desktop']),
153
('share/application-registry', ['bzr-gtk.applications']),
154
('share/pixmaps', ['icons/bzr-icon-64.png']),
155
('share/icons/hicolor/scalable/emblems',
156
['icons/emblem-bzr-added.svg',
157
'icons/emblem-bzr-conflict.svg',
158
'icons/emblem-bzr-controlled.svg',
159
'icons/emblem-bzr-modified.svg',
160
'icons/emblem-bzr-removed.svg',
161
'icons/emblem-bzr-ignored.svg'])
163
cmdclass={'install_data': InstallData,
164
'build_credits': CreateCredits,