3
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
from distutils.core import setup
23
description='Olive - Graphical frontend for Bazaar-NG',
24
author='Szilveszter Farkas (Phanatic)',
25
author_email='szilveszter.farkas@gmail.com',
26
url='https://launchpad.net/products/olive/',
27
packages=['olive', 'olive.backend', 'olive.frontend',
28
'olive.frontend.gtk', 'olive.frontend.gtk.viz'],
29
scripts=['olive-gtk'],
30
data_files=[('share/olive', ['olive.glade',
43
'icons/refresh.png']),
44
('share/applications', ['olive-gtk.desktop']),
45
('share/pixmaps', ['icons/olive-gtk.png'])
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
8
from distutils.dep_util import newer
9
from distutils.log import info
15
description = "Run unit tests"
19
def initialize_options(self):
22
def finalize_options(self):
25
def get_command_name(self):
29
from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
30
import __init__ as bzrgtk
31
runner = TextTestRunner()
34
suite.addTest(bzrgtk.test_suite())
35
result = runner.run(suite)
36
return result.wasSuccessful()
39
class CreateCredits(Command):
40
description = "Create credits file"
44
def initialize_options(self):
47
def finalize_options(self):
50
def get_command_name(self):
54
from bzrlib.branch import Branch
55
from bzrlib.plugins.stats import find_credits
59
branch = Branch.open(".")
60
credits = find_credits(branch.repository, branch.last_revision())
62
pickle.dump(credits, file("credits.pickle", 'w'))
66
def is_versioned(cmd):
67
from bzrlib.errors import NotBranchError
69
from bzrlib.branch import Branch
72
except NotBranchError:
76
class BuildData(build):
77
sub_commands = build.sub_commands[:]
78
sub_commands.append(('build_credits', is_versioned))
81
class InstallData(install_data):
83
self.data_files.extend(self._compile_po_files())
84
self.data_files.extend(self._nautilus_plugin())
85
install_data.run(self)
88
subprocess.check_call('gtk-update-icon-cache -f -t /usr/share/icons/hicolor')
92
def _compile_po_files(self):
95
# Don't install language files on Win32
96
if sys.platform == 'win32':
100
for po in glob.glob(os.path.join(PO_DIR,'*.po')):
101
lang = os.path.basename(po[:-3])
102
# It's necessary to compile in this directory (not in po_dir)
103
# because install_data can't rename file
104
mo = os.path.join('build', 'mo', lang, 'olive-gtk.mo')
106
directory = os.path.dirname(mo)
107
if not os.path.exists(directory):
108
info('creating %s' % directory)
109
os.makedirs(directory)
112
# True if mo doesn't exist
113
cmd = 'msgfmt -o %s %s' % (mo, po)
114
info('compiling %s -> %s' % (po, mo))
115
if os.system(cmd) != 0:
116
raise SystemExit('Error while running msgfmt')
118
dest = os.path.dirname(os.path.join('share', 'locale', lang, 'LC_MESSAGES', 'olive-gtk.mo'))
119
data_files.append((dest, [mo]))
123
def _nautilus_plugin(self):
125
if sys.platform[:5] == 'linux':
126
cmd = os.popen('pkg-config --variable=pythondir nautilus-python', 'r')
127
res = cmd.readline().strip()
132
files.append((dest, ['nautilus-bzr.py']))
140
maintainer = "Jelmer Vernooij",
141
maintainer_email = "jelmer@samba.org",
142
description = "GTK+ Frontends for various Bazaar commands",
143
license = "GNU GPL v2 or later",
144
scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
145
url = "http://bazaar-vcs.org/BzrGtk",
147
"bzrlib.plugins.gtk": ".",
148
"bzrlib.plugins.gtk.viz": "viz",
149
"bzrlib.plugins.gtk.annotate": "annotate",
150
"bzrlib.plugins.gtk.olive": "olive",
151
"bzrlib.plugins.gtk.tests": "tests",
152
"bzrlib.plugins.gtk.branchview": "branchview",
153
"bzrlib.plugins.gtk.preferences": "preferences",
156
"bzrlib.plugins.gtk",
157
"bzrlib.plugins.gtk.viz",
158
"bzrlib.plugins.gtk.annotate",
159
"bzrlib.plugins.gtk.olive",
160
"bzrlib.plugins.gtk.tests",
161
"bzrlib.plugins.gtk.branchview",
162
"bzrlib.plugins.gtk.preferences",
164
data_files=[('share/olive', ['cmenu.ui',
166
('share/bzr-gtk', ['credits.pickle']),
167
('share/bzr-gtk/icons', ['icons/commit.png',
168
'icons/commit16.png',
178
'icons/olive-gtk.png',
179
'icons/oliveicon2.png',
180
'icons/sign-bad.png',
183
'icons/sign-unknown.png',
186
'icons/bzr-icon-64.png']),
187
('share/applications', ['olive-gtk.desktop',
188
'bazaar-properties.desktop',
189
'bzr-handle-patch.desktop',
190
'bzr-notify.desktop']),
191
('share/application-registry', ['bzr-gtk.applications']),
192
('share/pixmaps', ['icons/olive-gtk.png', 'icons/bzr-icon-64.png']),
193
('share/icons/hicolor/scalable/emblems',
194
['icons/emblem-bzr-added.svg',
195
'icons/emblem-bzr-conflict.svg',
196
'icons/emblem-bzr-controlled.svg',
197
'icons/emblem-bzr-modified.svg',
198
'icons/emblem-bzr-removed.svg'])
200
cmdclass={'install_data': InstallData,
201
'build_credits': CreateCredits,