gui: allow torn widgets to be on top
[git-cola.git] / wscript
blob2f7778b71ffa1f6db5d5e1ee08f6f27dc0f63843
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 defaults = os.path.join(os.getcwd(), 'ugitlibs', 'defaults.py')
12 file = open(defaults, 'r')
13 contents = file.read()
14 file.close()
15 for line in contents.splitlines():
16 if line.startswith('VERSION = '):
17 version = line.replace('VERSION = ', '')
18 return version.strip("'")
19 raise Exception("Could not find VERSION field in %s" % defaults)
21 #############################################################################
22 # Mandatory variables
23 APPNAME = 'ugit'
24 VERSION = get_version()
26 srcdir = '.'
27 blddir = 'obj'
29 #############################################################################
30 # Options
31 def set_options(opt):
32 opt.tool_options('python')
33 opt.tool_options('pyuic4', 'build')
34 pass
36 #############################################################################
37 # Configure
38 def configure(conf):
39 env = conf.env
40 env['PYMODS'] = pymod(env['PREFIX'])
41 env['PYMODS_UGIT'] = os.path.join(env['PYMODS'], 'ugitlibs')
42 env['ICONS'] = os.path.join(env['PREFIX'], 'share', 'ugit', 'icons')
43 env['BIN'] = os.path.join(env['PREFIX'], 'bin')
45 conf.check_tool('python')
46 conf.check_tool('pyuic4', 'build')
47 conf.check_tool('po2qm', 'build')
49 #############################################################################
50 # Build
51 def build(bld):
52 bld.add_subdirs('ui ugitlibs')
54 bin = bld.create_obj('py')
55 bin.inst_var = 'BIN'
56 bin.chmod = 0755
57 bin.find_sources_in_dirs('bin')
59 qm = bld.create_obj('po2qm')
60 qm.find_sources_in_dirs('po')
62 for icon in glob.glob('icons/*.png'):
63 Common.install_files('ICONS', '', icon)
65 Common.symlink_as('BIN', 'ugit.py', 'ugit')
67 #############################################################################
68 # Other
69 def pymod(prefix):
70 """Returns a lib/python2.x/site-packages path relative to prefix"""
71 api_version = sys.version[:3]
72 python_api = 'python' + api_version
73 return os.path.join(prefix, 'lib', python_api, 'site-packages')