build: update build-win32.sh script for ugit rename
[git-cola.git] / wscript
blob4f1045b3a2db54e490685043a56e43af702a0b13
1 #!/usr/bin/env python
2 import os
3 import sys
4 import glob
5 import Params
6 import Common
8 # Release versioning
9 def get_version():
10 """Searches defaults.py for the VERSION field and returns it."""
11 cmd = os.path.join(os.getcwd(), 'scripts', 'version.sh')
12 pipe = os.popen(cmd)
13 version = pipe.read()
14 pipe.close()
15 return version.strip()
17 #############################################################################
18 # Mandatory variables
19 APPNAME = 'ugit'
20 VERSION = get_version()
22 srcdir = '.'
23 blddir = 'obj'
25 #############################################################################
26 # Options
27 def set_options(opt):
28 opt.tool_options('python')
29 opt.tool_options('pyuic4', 'build')
30 pass
32 #############################################################################
33 # Configure
34 def configure(conf):
35 env = conf.env
36 env['PYMODS'] = pymod(env['PREFIX'])
37 env['PYMODS_UGIT'] = os.path.join(env['PYMODS'], 'ugit')
38 env['ICONS'] = os.path.join(env['PREFIX'], 'share', 'ugit', 'icons')
39 env['BIN'] = os.path.join(env['PREFIX'], 'bin')
41 conf.check_tool('python')
42 conf.check_tool('pyuic4', 'build')
43 conf.check_tool('po2qm', 'build')
45 #############################################################################
46 # Build
47 def build(bld):
48 bld.add_subdirs('ui ugit')
50 bin = bld.create_obj('py')
51 bin.inst_var = 'BIN'
52 bin.chmod = 0755
53 bin.find_sources_in_dirs('bin')
55 qm = bld.create_obj('po2qm')
56 qm.find_sources_in_dirs('po')
58 for icon in glob.glob('icons/*.png'):
59 Common.install_files('ICONS', '', icon)
61 Common.symlink_as('BIN', 'git-ugit.py', 'ugit')
63 #############################################################################
64 # Other
65 def pymod(prefix):
66 """Returns a lib/python2.x/site-packages path relative to prefix"""
67 api_version = sys.version[:3]
68 python_api = 'python' + api_version
69 return os.path.join(prefix, 'lib', python_api, 'site-packages')