/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Jelmer Vernooij
  • Date: 2010-05-25 17:09:02 UTC
  • mto: This revision was merged to the branch mainline in revision 691.
  • Revision ID: jelmer@samba.org-20100525170902-3to8g5iw7ovw79kh
Split out olive into a separate directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
4
 
#
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.
9
 
#
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.
14
 
#
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
18
 
 
19
 
from distutils.core import setup
20
 
 
21
 
setup(name='Olive',
22
 
      version='0.1',
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',
31
 
                                   'oliveicon2.png',
32
 
                                   'cmenu.ui',
33
 
                                   'icons/commit.png',
34
 
                                   'icons/commit16.png',
35
 
                                   'icons/diff.png',
36
 
                                   'icons/diff16.png',
37
 
                                   'icons/log.png',
38
 
                                   'icons/log16.png',
39
 
                                   'icons/pull.png',
40
 
                                   'icons/pull16.png',
41
 
                                   'icons/push.png',
42
 
                                   'icons/push16.png',
43
 
                                   'icons/refresh.png']),
44
 
                  ('share/applications', ['olive-gtk.desktop']),
45
 
                  ('share/pixmaps', ['icons/olive-gtk.png'])
46
 
                 ]
47
 
     )
 
1
#!/usr/bin/python
 
2
 
 
3
"""GTK+ Frontends for various Bazaar commands."""
 
4
 
 
5
from distutils.core import setup, Command
 
6
from distutils.command.install_data import install_data
 
7
from distutils.command.build import build
 
8
import os
 
9
import sys
 
10
 
 
11
class Check(Command):
 
12
    description = "Run unit tests"
 
13
 
 
14
    user_options = []
 
15
 
 
16
    def initialize_options(self):
 
17
        pass
 
18
 
 
19
    def finalize_options(self):
 
20
        pass
 
21
 
 
22
    def get_command_name(self):
 
23
        return 'test'
 
24
 
 
25
    def run(self):
 
26
        from bzrlib.tests import TestLoader, TestSuite, TextTestRunner
 
27
        import __init__ as bzrgtk
 
28
        runner = TextTestRunner()
 
29
        loader = TestLoader()
 
30
        suite = TestSuite()
 
31
        suite.addTest(bzrgtk.test_suite())
 
32
        result = runner.run(suite)
 
33
        return result.wasSuccessful()
 
34
 
 
35
 
 
36
class CreateCredits(Command):
 
37
    description = "Create credits file"
 
38
 
 
39
    user_options = [("url=", None, "URL of branch")]
 
40
 
 
41
    def initialize_options(self):
 
42
        self.url = "."
 
43
 
 
44
    def finalize_options(self):
 
45
        pass
 
46
 
 
47
    def get_command_name(self):
 
48
        return 'build_credits'
 
49
 
 
50
    def run(self):
 
51
        from bzrlib.plugin import load_plugins; load_plugins()
 
52
        from bzrlib.branch import Branch
 
53
        from bzrlib.plugins.stats import find_credits
 
54
 
 
55
        import pickle
 
56
 
 
57
        branch = Branch.open(self.url)
 
58
        credits = find_credits(branch.repository, branch.last_revision())
 
59
 
 
60
        pickle.dump(credits, file("credits.pickle", 'w'))
 
61
        return True
 
62
 
 
63
 
 
64
def is_versioned(cmd):
 
65
    from bzrlib.errors import NotBranchError
 
66
    try:
 
67
        from bzrlib.branch import Branch
 
68
        Branch.open(".")
 
69
        return True
 
70
    except NotBranchError:
 
71
        return False
 
72
 
 
73
 
 
74
class BuildData(build):
 
75
    sub_commands = build.sub_commands[:]
 
76
    sub_commands.append(('build_credits', is_versioned))
 
77
 
 
78
 
 
79
class InstallData(install_data):
 
80
 
 
81
    def run(self):
 
82
        import subprocess
 
83
        self.data_files.extend(self._nautilus_plugin())
 
84
        install_data.run(self)
 
85
 
 
86
        try:
 
87
            subprocess.check_call('gtk-update-icon-cache '
 
88
                                  '-f -t /usr/share/icons/hicolor')
 
89
        except OSError:
 
90
            pass
 
91
 
 
92
    def _nautilus_plugin(self):
 
93
        files = []
 
94
        if sys.platform[:5] == 'linux':
 
95
            cmd = os.popen('pkg-config --variable=pythondir nautilus-python',
 
96
                           'r')
 
97
            res = cmd.readline().strip()
 
98
            ret = cmd.close()
 
99
            if ret is None:
 
100
                dest = res[5:]
 
101
                files.append((dest, ['nautilus-bzr.py']))
 
102
        return files
 
103
 
 
104
 
 
105
if __name__ == '__main__':
 
106
    setup(
 
107
        name = "bzr-gtk",
 
108
        version = "0.99.0",
 
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",
 
115
        package_dir = {
 
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",
 
122
            },
 
123
        packages = [
 
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",
 
130
        ],
 
131
        data_files=[ ('share/bzr-gtk', ['credits.pickle']),
 
132
                    ('share/bzr-gtk/icons', ['icons/commit.png',
 
133
                                             'icons/commit16.png',
 
134
                                             'icons/diff.png',
 
135
                                             'icons/diff16.png',
 
136
                                             'icons/log.png',
 
137
                                             'icons/log16.png',
 
138
                                             'icons/pull.png',
 
139
                                             'icons/pull16.png',
 
140
                                             'icons/push.png',
 
141
                                             'icons/push16.png',
 
142
                                             'icons/refresh.png',
 
143
                                             'icons/sign-bad.png',
 
144
                                             'icons/sign-ok.png',
 
145
                                             'icons/sign.png',
 
146
                                             'icons/sign-unknown.png',
 
147
                                             'icons/tag-16.png',
 
148
                                             'icons/bug.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'])
 
162
                    ],
 
163
        cmdclass={'install_data': InstallData,
 
164
                  'build_credits': CreateCredits,
 
165
                  'build': BuildData,
 
166
                  'check': Check}
 
167
        )