2
"""GTK+ Frontends for various Bazaar commands."""
6
from distutils.core import setup, Command
7
from distutils.command.install_data import install_data
8
from distutils.command.build import build
13
description = "Run unit tests"
17
def initialize_options(self):
20
def finalize_options(self):
23
def get_command_name(self):
27
from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
28
import __init__ as bzrgtk
29
runner = TextTestRunner()
32
suite.addTest(bzrgtk.test_suite())
33
result = runner.run(suite)
34
return result.wasSuccessful()
37
class CreateCredits(Command):
38
description = "Create credits file"
40
user_options = [("url=", None, "URL of branch")]
42
def initialize_options(self):
45
def finalize_options(self):
48
def get_command_name(self):
49
return 'build_credits'
52
from bzrlib.plugin import load_plugins; load_plugins()
53
from bzrlib.branch import Branch
54
from bzrlib.plugins.stats.cmds import find_credits
58
branch = Branch.open(self.url)
59
credits = find_credits(branch.repository, branch.last_revision())
61
pickle.dump(credits, file("credits.pickle", 'w'))
65
def is_versioned(cmd):
66
from bzrlib.errors import NotBranchError
68
from bzrlib.branch import Branch
71
except NotBranchError:
75
class BuildData(build):
76
sub_commands = build.sub_commands[:]
77
sub_commands.append(('build_credits', is_versioned))
80
class InstallData(install_data):
84
self.data_files.extend(self._nautilus_plugin())
85
install_data.run(self)
88
subprocess.check_call('gtk-update-icon-cache '
89
'-f -t /usr/share/icons/hicolor')
93
def _nautilus_plugin(self):
95
if sys.platform[:5] == 'linux':
96
cmd = os.popen('pkg-config --variable=pythondir nautilus-python',
98
res = cmd.readline().strip()
102
files.append((dest, ['nautilus-bzr.py']))
106
if __name__ == '__main__':
107
version = bzr_plugin_version[:3]
108
version_string = ".".join([str(x) for x in version])
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",
119
"bzrlib.plugins.gtk": ".",
120
"bzrlib.plugins.gtk.viz": "viz",
121
"bzrlib.plugins.gtk.annotate": "annotate",
122
"bzrlib.plugins.gtk.tests": "tests",
123
"bzrlib.plugins.gtk.branchview": "branchview",
124
"bzrlib.plugins.gtk.preferences": "preferences",
127
"bzrlib.plugins.gtk",
128
"bzrlib.plugins.gtk.viz",
129
"bzrlib.plugins.gtk.annotate",
130
"bzrlib.plugins.gtk.tests",
131
"bzrlib.plugins.gtk.branchview",
132
"bzrlib.plugins.gtk.preferences",
134
data_files=[ ('share/bzr-gtk', ['credits.pickle']),
135
('share/bzr-gtk/icons', ['icons/commit.png',
136
'icons/commit16.png',
146
'icons/sign-bad.png',
149
'icons/sign-unknown.png',
152
'icons/bzr-icon-64.png']),
153
('share/applications', ['bazaar-properties.desktop',
154
'bzr-handle-patch.desktop',
155
'bzr-notify.desktop']),
156
('share/application-registry', ['bzr-gtk.applications']),
157
('share/pixmaps', ['icons/bzr-icon-64.png']),
158
('share/icons/hicolor/scalable/emblems',
159
['icons/emblem-bzr-added.svg',
160
'icons/emblem-bzr-conflict.svg',
161
'icons/emblem-bzr-controlled.svg',
162
'icons/emblem-bzr-modified.svg',
163
'icons/emblem-bzr-removed.svg',
164
'icons/emblem-bzr-ignored.svg'])
166
cmdclass={'install_data': InstallData,
167
'build_credits': CreateCredits,