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"
42
user_options = [("url=", None, "URL of branch")]
44
def initialize_options(self):
47
def finalize_options(self):
50
def get_command_name(self):
51
return 'build_credits'
54
from bzrlib.plugin import load_plugins; load_plugins()
55
from bzrlib.branch import Branch
56
from bzrlib.plugins.stats import find_credits
60
branch = Branch.open(self.url)
61
credits = find_credits(branch.repository, branch.last_revision())
63
pickle.dump(credits, file("credits.pickle", 'w'))
67
def is_versioned(cmd):
68
from bzrlib.errors import NotBranchError
70
from bzrlib.branch import Branch
73
except NotBranchError:
77
class BuildData(build):
78
sub_commands = build.sub_commands[:]
79
sub_commands.append(('build_credits', is_versioned))
82
class InstallData(install_data):
86
self.data_files.extend(self._compile_po_files())
87
self.data_files.extend(self._nautilus_plugin())
88
install_data.run(self)
91
subprocess.check_call('gtk-update-icon-cache '
92
'-f -t /usr/share/icons/hicolor')
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
def _nautilus_plugin(self):
128
if sys.platform[:5] == 'linux':
129
cmd = os.popen('pkg-config --variable=pythondir nautilus-python',
131
res = cmd.readline().strip()
135
files.append((dest, ['nautilus-bzr.py']))
139
if __name__ == '__main__':
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",
150
"bzrlib.plugins.gtk": ".",
151
"bzrlib.plugins.gtk.viz": "viz",
152
"bzrlib.plugins.gtk.annotate": "annotate",
153
"bzrlib.plugins.gtk.olive": "olive",
154
"bzrlib.plugins.gtk.tests": "tests",
155
"bzrlib.plugins.gtk.branchview": "branchview",
156
"bzrlib.plugins.gtk.preferences": "preferences",
159
"bzrlib.plugins.gtk",
160
"bzrlib.plugins.gtk.viz",
161
"bzrlib.plugins.gtk.annotate",
162
"bzrlib.plugins.gtk.olive",
163
"bzrlib.plugins.gtk.tests",
164
"bzrlib.plugins.gtk.branchview",
165
"bzrlib.plugins.gtk.preferences",
167
data_files=[('share/olive', ['cmenu.ui',
169
('share/bzr-gtk', ['credits.pickle']),
170
('share/bzr-gtk/icons', ['icons/commit.png',
171
'icons/commit16.png',
181
'icons/olive-gtk.png',
182
'icons/oliveicon2.png',
183
'icons/sign-bad.png',
186
'icons/sign-unknown.png',
189
'icons/bzr-icon-64.png']),
190
('share/applications', ['olive-gtk.desktop',
191
'bazaar-properties.desktop',
192
'bzr-handle-patch.desktop',
193
'bzr-notify.desktop']),
194
('share/application-registry', ['bzr-gtk.applications']),
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',
201
'icons/emblem-bzr-modified.svg',
202
'icons/emblem-bzr-removed.svg',
203
'icons/emblem-bzr-ignored.svg'])
205
cmdclass={'install_data': InstallData,
206
'build_credits': CreateCredits,
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from distutils.core import setup
21
description='Olive - Graphical frontend for Bazaar-NG',
22
author='Szilveszter Farkas (Phanatic)',
23
author_email='szilveszter.farkas@gmail.com',
24
url='https://launchpad.net/products/olive/',
25
packages=['olive.backend', 'olive.frontend.gtk'],
26
package_dir={'olive.backend': 'olive/backend', 'olive.frontend.gtk': 'olive/frontend/gtk'})
b'\\ No newline at end of file'