/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: Mark Lee
  • Date: 2009-07-11 18:39:14 UTC
  • mto: This revision was merged to the branch mainline in revision 661.
  • Revision ID: bzr@lazymalevolence.com-20090711183914-zuii3et5skiv2njo
Re-ignore credits.pickle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from distutils.core import setup, Command
6
6
from distutils.command.install_data import install_data
7
7
from distutils.command.build import build
 
8
from distutils.dep_util import newer
 
9
from distutils.log import info
 
10
import glob
8
11
import os
9
12
import sys
10
13
 
77
80
 
78
81
 
79
82
class InstallData(install_data):
80
 
 
81
83
    def run(self):
82
 
        import subprocess
 
84
        self.data_files.extend(self._compile_po_files())
83
85
        self.data_files.extend(self._nautilus_plugin())
84
86
        install_data.run(self)
85
87
 
86
88
        try:
87
 
            subprocess.check_call('gtk-update-icon-cache '
88
 
                                  '-f -t /usr/share/icons/hicolor')
89
 
        except OSError:
 
89
            subprocess.check_call('gtk-update-icon-cache -f -t /usr/share/icons/hicolor')
 
90
        except:
90
91
            pass
91
92
 
 
93
    def _compile_po_files(self):
 
94
        data_files = []
 
95
        
 
96
        # Don't install language files on Win32
 
97
        if sys.platform == 'win32':
 
98
            return data_files
 
99
        
 
100
        PO_DIR = 'po'
 
101
        for po in glob.glob(os.path.join(PO_DIR,'*.po')):
 
102
            lang = os.path.basename(po[:-3])
 
103
            # It's necessary to compile in this directory (not in po_dir)
 
104
            # because install_data can't rename file
 
105
            mo = os.path.join('build', 'mo', lang, 'olive-gtk.mo')
 
106
            
 
107
            directory = os.path.dirname(mo)
 
108
            if not os.path.exists(directory):
 
109
                info('creating %s' % directory)
 
110
                os.makedirs(directory)
 
111
            
 
112
            if newer(po, mo):
 
113
                # True if mo doesn't exist
 
114
                cmd = 'msgfmt -o %s %s' % (mo, po)
 
115
                info('compiling %s -> %s' % (po, mo))
 
116
                if os.system(cmd) != 0:
 
117
                    raise SystemExit('Error while running msgfmt')
 
118
                
 
119
                dest = os.path.dirname(os.path.join('share', 'locale', lang, 'LC_MESSAGES', 'olive-gtk.mo'))
 
120
                data_files.append((dest, [mo]))
 
121
        
 
122
        return data_files
 
123
    
92
124
    def _nautilus_plugin(self):
93
125
        files = []
94
126
        if sys.platform[:5] == 'linux':
95
 
            cmd = os.popen('pkg-config --variable=pythondir nautilus-python',
96
 
                           'r')
 
127
            cmd = os.popen('pkg-config --variable=pythondir nautilus-python', 'r')
97
128
            res = cmd.readline().strip()
98
129
            ret = cmd.close()
 
130
            
99
131
            if ret is None:
100
132
                dest = res[5:]
101
133
                files.append((dest, ['nautilus-bzr.py']))
 
134
        
102
135
        return files
103
136
 
104
137
 
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",
 
138
setup(
 
139
    name = "bzr-gtk",
 
140
    version = "0.97.0",
 
141
    maintainer = "Jelmer Vernooij",
 
142
    maintainer_email = "jelmer@samba.org",
 
143
    description = "GTK+ Frontends for various Bazaar commands",
 
144
    license = "GNU GPL v2 or later",
 
145
    scripts = ['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
 
146
    url = "http://bazaar-vcs.org/BzrGtk",
 
147
    package_dir = {
 
148
        "bzrlib.plugins.gtk": ".",
 
149
        "bzrlib.plugins.gtk.viz": "viz", 
 
150
        "bzrlib.plugins.gtk.annotate": "annotate",
 
151
        "bzrlib.plugins.gtk.olive": "olive",
 
152
        "bzrlib.plugins.gtk.tests": "tests",
 
153
        "bzrlib.plugins.gtk.branchview": "branchview",
 
154
        "bzrlib.plugins.gtk.preferences": "preferences",
 
155
        },
 
156
    packages = [
 
157
        "bzrlib.plugins.gtk",
 
158
        "bzrlib.plugins.gtk.viz",
 
159
        "bzrlib.plugins.gtk.annotate",
 
160
        "bzrlib.plugins.gtk.olive",
 
161
        "bzrlib.plugins.gtk.tests",
 
162
        "bzrlib.plugins.gtk.branchview",
 
163
        "bzrlib.plugins.gtk.preferences",
130
164
        ],
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
 
        )
 
165
    data_files=[('share/olive', ['cmenu.ui',
 
166
                                ]),
 
167
                ('share/bzr-gtk', ['credits.pickle']),
 
168
               ('share/bzr-gtk/icons', ['icons/commit.png',
 
169
                                 'icons/commit16.png',
 
170
                                 'icons/diff.png',
 
171
                                 'icons/diff16.png',
 
172
                                 'icons/log.png',
 
173
                                 'icons/log16.png',
 
174
                                 'icons/pull.png',
 
175
                                 'icons/pull16.png',
 
176
                                 'icons/push.png',
 
177
                                 'icons/push16.png',
 
178
                                 'icons/refresh.png',
 
179
                                 'icons/olive-gtk.png',
 
180
                                 'icons/oliveicon2.png',
 
181
                                 'icons/sign-bad.png',
 
182
                                 'icons/sign-ok.png',
 
183
                                 'icons/sign.png',
 
184
                                 'icons/sign-unknown.png',
 
185
                                 'icons/tag-16.png',
 
186
                                 'icons/bug.png',
 
187
                                 'icons/bzr-icon-64.png']),
 
188
                ('share/applications', ['olive-gtk.desktop',
 
189
                                        'bazaar-properties.desktop',
 
190
                                        'bzr-handle-patch.desktop',
 
191
                                        'bzr-notify.desktop']),
 
192
                ('share/application-registry', ['bzr-gtk.applications']),
 
193
                ('share/pixmaps', ['icons/olive-gtk.png', 'icons/bzr-icon-64.png']),
 
194
                ('share/icons/hicolor/scalable/emblems', 
 
195
                    ['icons/emblem-bzr-added.svg', 
 
196
                        'icons/emblem-bzr-conflict.svg', 
 
197
                        'icons/emblem-bzr-controlled.svg', 
 
198
                        'icons/emblem-bzr-modified.svg',
 
199
                        'icons/emblem-bzr-removed.svg'])
 
200
               ],
 
201
    cmdclass={'install_data': InstallData,
 
202
              'build_credits': CreateCredits,
 
203
              'build': BuildData,
 
204
              'check': Check}
 
205
)