Add internationalization support to ugit
[ugit.git] / wscript
blob12746c3330ea8683f4cab657742341a2c51e5f11
1 #!/usr/bin/env python
2 import os
3 import sys
4 import glob
5 import Params
6 import Common
8 #############################################################################
9 # Mandatory variables
10 APPNAME = 'ugit'
11 VERSION = '0.5.0'
12 srcdir = '.'
13 blddir = 'build'
15 #############################################################################
16 # Options
17 def set_options(opt):
18 opt.tool_options('python')
19 opt.tool_options('pyuic4', 'buildutils')
20 pass
22 #############################################################################
23 # Configure
24 def configure(conf):
25 env = conf.env
26 env['PYMODS'] = pymod(env['PREFIX'])
27 env['PYMODS_UGIT'] = os.path.join(env['PYMODS'], 'ugitlibs')
28 env['ICONS'] = os.path.join(env['PREFIX'], 'share', 'ugit', 'icons')
29 env['BIN'] = os.path.join(env['PREFIX'], 'bin')
31 if not conf.check_tool('python'):
32 Params.fatal('Error: could not find Python.')
34 if not conf.check_tool('pyuic4', 'buildutils'):
35 Params.fatal('Error: missing PyQt4 development tools.')
37 if not conf.check_tool('po2qm', 'buildutils'):
38 Params.fatal('Error: missing msgfmt executable.')
40 #############################################################################
41 # Build
42 def build(bld):
43 bld.add_subdirs('ui ugitlibs')
45 bin = bld.create_obj('py')
46 bin.inst_var = 'BIN'
47 bin.chmod = 0755
48 bin.find_sources_in_dirs('bin')
50 qm = bld.create_obj('po2qm')
51 qm.find_sources_in_dirs('po')
53 for icon in glob.glob('icons/*.png'):
54 Common.install_files('ICONS', '', icon)
56 Common.symlink_as('BIN', 'ugit.py', 'ugit')
58 #############################################################################
59 # Other
60 def pymod(prefix):
61 '''Returns a lib/python2.x/site-packages path relative to prefix'''
62 api_version = sys.version[:3]
63 python_api = 'python' + api_version
64 return os.path.join(prefix, 'lib', python_api, 'site-packages')