Use os.listdir intead of ls
[ugit.git] / wscript
blob302100908e8ee1d4c75266d718b0bd57195c9328
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 conf.check_tool('python')
32 conf.check_tool('pyuic4', 'buildutils')
33 conf.check_tool('po2qm', 'buildutils')
35 #############################################################################
36 # Build
37 def build(bld):
38 bld.add_subdirs('ui ugitlibs')
40 bin = bld.create_obj('py')
41 bin.inst_var = 'BIN'
42 bin.chmod = 0755
43 bin.find_sources_in_dirs('bin')
45 qm = bld.create_obj('po2qm')
46 qm.find_sources_in_dirs('po')
48 for icon in glob.glob('icons/*.png'):
49 Common.install_files('ICONS', '', icon)
51 Common.symlink_as('BIN', 'ugit.py', 'ugit')
53 #############################################################################
54 # Other
55 def pymod(prefix):
56 '''Returns a lib/python2.x/site-packages path relative to prefix'''
57 api_version = sys.version[:3]
58 python_api = 'python' + api_version
59 return os.path.join(prefix, 'lib', python_api, 'site-packages')