cola: include GitPython to make installation simpler for users
[git-cola.git] / wscript
bloba4372b5778da342044f0f41ac4caf7d814a77362
1 #!/usr/bin/env python
2 import os
3 import sys
4 import glob
5 import Params
6 import Common
7 from os.path import join
9 # Release versioning
10 def get_version():
11 """Runs version.sh and returns the output."""
12 cmd = join(os.getcwd(), 'scripts', 'version.sh')
13 pipe = os.popen(cmd)
14 version = pipe.read()
15 pipe.close()
16 return version.strip()
18 #############################################################################
19 # Mandatory variables
20 APPNAME = 'cola'
21 VERSION = get_version()
23 srcdir = '.'
24 blddir = 'obj'
26 #############################################################################
27 # Options
28 def set_options(opt):
29 opt.tool_options('python')
30 opt.tool_options('pyuic4', 'build')
31 pass
33 #############################################################################
34 # Configure
35 def configure(conf):
36 conf.check_tool('misc')
37 conf.check_tool('python')
38 conf.check_tool('pyuic4', 'build')
39 conf.check_tool('po2qm', 'build')
41 env = conf.env
42 prefix = env['PREFIX']
43 bindir = join(prefix, 'bin')
44 share = join(prefix, 'share')
45 modules = join(share, 'cola')
46 views = join(modules, 'views')
47 controllers = join(modules, 'controllers')
48 icons = join(prefix, 'share', 'cola', 'icons')
49 apps = join(prefix, 'share', 'applications')
51 env['COLA_BINDIR'] = bindir
52 env['COLA_MODULES'] = modules
53 env['COLA_VIEWS'] = views
54 env['COLA_CONTROLLERS'] = controllers
55 env['COLA_ICONS'] = icons
56 env['COLA_APPS'] = apps
58 try:
59 import git
60 except ImportError:
61 print """
62 ERROR: could not "import git"
64 Please install the python-git package
65 or grab GitPython from the cheeseshop:
67 http://pypi.python.org/pypi/GitPython
70 GitPython's git repository can be cloned from gitorious:
72 http://gitorious.org/projects/git-python
73 """
74 return False
76 #############################################################################
77 # Build
78 def build(bld):
79 bld.add_subdirs("""
80 scripts
82 cola
83 """)
85 qm = bld.create_obj('po2qm')
86 qm.find_sources_in_dirs('po')
88 for icon in glob.glob('icons/*.png'):
89 Common.install_files('COLA_ICONS', '', icon)
91 #############################################################################
92 # Shutdown
93 def shutdown():
94 # always re-create the version.py file
95 for variant in Params.g_build.m_allenvs:
96 version_file = join(Params.g_build.m_bdir,
97 variant,
98 'scripts',
99 'version.py')
100 if os.path.exists(version_file):
101 os.unlink(version_file)