3
2
"""GTK+ Frontends for various Bazaar commands."""
7
from info import bzr_plugin_version
5
9
from distutils.core import setup, Command
6
10
from distutils.command.install_data import install_data
7
11
from distutils.command.build import build
8
from distutils.dep_util import newer
9
from distutils.log import info
12
from distutils.command.sdist import sdist
14
from DistUtilsExtra.command import build_i18n
16
# Python distutils extra is not available.
17
class cmd_build_i18n(build):
20
def initialize_options(self):
22
self.desktop_files = None
24
def finalize_options(self):
28
print >> sys.stderr, (
29
"For internationalization support you'll need to install "
30
"https://launchpad.net/python-distutils-extra")
32
# Use build_i18n from DistUtilsExtra
33
cmd_build_i18n = build_i18n.build_i18n
14
36
class Check(Command):
15
37
description = "Run unit tests"
40
('module=', 'm', 'The test module to run'),
19
43
def initialize_options(self):
22
46
def finalize_options(self):
29
53
from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
30
import __init__ as bzrgtk
54
from bzrlib.plugin import PluginImporter
55
PluginImporter.specific_paths["bzrlib.plugins.gtk"] = os.path.dirname(
57
from bzrlib.plugins.gtk.tests import load_tests
60
load_tests(suite, self.module, loader)
31
61
runner = TextTestRunner()
34
suite.addTest(bzrgtk.test_suite())
35
62
result = runner.run(suite)
36
63
return result.wasSuccessful()
79
107
sub_commands.append(('build_credits', is_versioned))
110
class SourceDist(sdist):
111
sub_commands = sdist.sub_commands[:]
112
sub_commands.append(('build_credits', is_versioned))
82
115
class InstallData(install_data):
86
self.data_files.extend(self._compile_po_files())
87
119
self.data_files.extend(self._nautilus_plugin())
88
120
install_data.run(self)
96
def _compile_po_files(self):
99
# Don't install language files on Win32
100
if sys.platform == 'win32':
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')
110
directory = os.path.dirname(mo)
111
if not os.path.exists(directory):
112
info('creating %s' % directory)
113
os.makedirs(directory)
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]))
126
128
def _nautilus_plugin(self):
128
130
if sys.platform[:5] == 'linux':
139
141
if __name__ == '__main__':
142
version = bzr_plugin_version[:3]
143
version_string = ".".join([str(x) for x in version])
143
maintainer = "Jelmer Vernooij",
144
maintainer_email = "jelmer@samba.org",
145
description = "GTK+ Frontends for various Bazaar commands",
146
license = "GNU GPL v2 or later",
147
scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
148
url = "http://bazaar-vcs.org/BzrGtk",
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",
150
154
"bzrlib.plugins.gtk": ".",
151
155
"bzrlib.plugins.gtk.viz": "viz",
152
156
"bzrlib.plugins.gtk.annotate": "annotate",
153
"bzrlib.plugins.gtk.olive": "olive",
154
157
"bzrlib.plugins.gtk.tests": "tests",
155
158
"bzrlib.plugins.gtk.branchview": "branchview",
156
159
"bzrlib.plugins.gtk.preferences": "preferences",
159
162
"bzrlib.plugins.gtk",
160
163
"bzrlib.plugins.gtk.viz",
161
164
"bzrlib.plugins.gtk.annotate",
162
"bzrlib.plugins.gtk.olive",
163
165
"bzrlib.plugins.gtk.tests",
164
166
"bzrlib.plugins.gtk.branchview",
165
167
"bzrlib.plugins.gtk.preferences",
167
data_files=[('share/olive', ['cmenu.ui',
169
('share/bzr-gtk', ['credits.pickle']),
169
data_files=[('share/bzr-gtk', ['credits.pickle']),
170
170
('share/bzr-gtk/icons', ['icons/commit.png',
171
171
'icons/commit16.png',
172
172
'icons/diff.png',
187
185
'icons/tag-16.png',
189
187
'icons/bzr-icon-64.png']),
190
('share/applications', ['olive-gtk.desktop',
191
'bazaar-properties.desktop',
192
'bzr-handle-patch.desktop',
193
'bzr-notify.desktop']),
188
# In case Python distutils extra is not available,
189
# install the .desktop files
190
('share/applications', ['bazaar-properties.desktop',
191
'bzr-handle-patch.desktop']),
194
192
('share/application-registry', ['bzr-gtk.applications']),
195
('share/pixmaps', ['icons/olive-gtk.png',
196
'icons/bzr-icon-64.png']),
193
('share/pixmaps', ['icons/bzr-icon-64.png']),
194
('share/icons/hicolor/scalable/apps',
195
['icons/bzr-panel.svg']),
197
196
('share/icons/hicolor/scalable/emblems',
198
197
['icons/emblem-bzr-added.svg',
199
198
'icons/emblem-bzr-conflict.svg',