Merge branch 'upstream' for new release 2.1
[debian/pino.git] / wscript
1 #!/usr/bin/env python
2
3 import intltool
4
5 VERSION = "0.2.1"
6 VERSION_MAJOR_MINOR =  ".".join(VERSION.split(".")[0:2])
7 APPNAME = "pino"
8
9 srcdir = '.'
10 blddir = '_build_'
11
12 def set_options(opt):
13         opt.tool_options('compiler_cc')
14         opt.tool_options('gnu_dirs')
15
16 def configure(conf):
17         conf.check_tool('compiler_cc vala gnu_dirs intltool')
18         conf.check_cfg(package='glib-2.0', uselib_store='GLIB',
19                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
20         conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT',
21                 atleast_version='2.14.0', mandatory=True, args='--cflags --libs')
22         conf.check_cfg(package='gtk+-2.0', uselib_store='GTK+',
23                 atleast_version='2.10.0', mandatory=True, args='--cflags --libs')
24         conf.check_cfg(package='gee-1.0', uselib_store='GEE',
25                 atleast_version='0.5.0', mandatory=True, args='--cflags --libs')
26         conf.check_cfg(package='gio-2.0', uselib_store='GIO',
27                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
28         conf.check_cfg(package='libnotify', uselib_store='LIBNOTIFY',
29                 mandatory=True, args='--cflags --libs')
30         #conf.check_cfg(package='libsexy', uselib_store='GTK+',
31         #               mandatory=True, args='--cflags --libs')
32         conf.check_cfg(package='libsoup-2.4', uselib_store='LIBSOUP',
33                 atleast_version='2.4', mandatory=True, args='--cflags --libs')
34         conf.check_cfg(package='libxml-2.0', uselib_store='LIBXML',
35                 atleast_version='2.0', mandatory=True, args='--cflags --libs')
36         conf.check_cfg(package='webkit-1.0', uselib_store='WEBKIT',
37                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
38         conf.check_cfg(package='unique-1.0', uselib_store='LIBUNIQUE',
39                 atleast_version='1.0', mandatory=True, args='--cflags --libs')
40
41         conf.define('PACKAGE', APPNAME)
42         conf.define('PACKAGE_NAME', APPNAME)
43         conf.define('PACKAGE_STRING', APPNAME + '-' + VERSION)
44         conf.define('PACKAGE_VERSION', APPNAME + '-' + VERSION)
45
46         conf.define('APP_VERSION', VERSION)
47         conf.define('LOGO_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino.svg')
48         conf.define('LOGO_FRESH_PATH', conf.env.PREFIX + '/share/icons/hicolor/scalable/apps/pino_fresh.svg')
49         conf.define('MENTIONS_PATH', conf.env.PREFIX + '/share/pino/icons/mentions.svg')
50         conf.define('MENTIONS_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/mentions_fresh.svg')
51         conf.define('TIMELINE_PATH', conf.env.PREFIX + '/share/pino/icons/timeline.svg')
52         conf.define('TIMELINE_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/timeline_fresh.svg')
53         conf.define('DIRECT_PATH', conf.env.PREFIX + '/share/pino/icons/direct.svg')
54         conf.define('DIRECT_FRESH_PATH', conf.env.PREFIX + '/share/pino/icons/direct_fresh.svg')
55         conf.define('PROGRESS_PATH', conf.env.PREFIX + '/share/pino/icons/progress.gif')
56         conf.define('DIRECT_REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/direct_reply.png')
57         conf.define('REPLY_PATH', conf.env.PREFIX + '/share/pino/icons/reply.png')
58         conf.define('RETWEET_PATH', conf.env.PREFIX + '/share/pino/icons/re_tweet.png')
59         conf.define('DELETE_PATH', conf.env.PREFIX + '/share/pino/icons/delete_status.png')
60         conf.define('USERPIC_PATH', conf.env.PREFIX + '/share/pino/icons/userpic.svg')
61         conf.define('TEMPLATES_PATH', conf.env.PREFIX + '/share/pino/templates')
62         conf.define('VERSION_MAJOR_MINOR', VERSION_MAJOR_MINOR)
63         conf.define('LOCALE_DIR', conf.env.PREFIX + '/share/locale/')
64         conf.define('GETTEXT_PACKAGE', APPNAME)
65         conf.define('APPNAME', APPNAME)
66         
67         # AUTHORS --> About dialog
68         f = open('AUTHORS', 'r')
69         data = f.read()
70         f.close()
71         import re
72         data = re.sub(r'\n', r'\\n', data)
73         conf.define('AUTHORS', data)
74         #end
75         
76         conf.write_config_header("config.h")
77         init_defs(conf.env.PREFIX)
78
79 def init_defs(prefix):
80         """
81         import re
82         data = re.sub(r'string PREFIX = \"(.*)\";', 'string PREFIX = "' + prefix + '";', data)
83         
84         f = open('src/defs.vala', 'w')
85         f.write(data)
86         f.close()
87         """
88
89 def build(bld):
90         bld.add_subdirs('src')
91         bld.add_subdirs('templates')
92         bld.add_subdirs('po')
93         
94         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino.svg')
95         bld.install_files('${PREFIX}/share/icons/hicolor/scalable/apps', 'img/pino_fresh.svg')
96         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions.svg')
97         bld.install_files('${PREFIX}/share/pino/icons', 'img/mentions_fresh.svg')
98         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline.svg')
99         bld.install_files('${PREFIX}/share/pino/icons', 'img/timeline_fresh.svg')
100         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct.svg')
101         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_fresh.svg')
102         bld.install_files('${PREFIX}/share/pino/icons', 'img/progress.gif')
103         bld.install_files('${PREFIX}/share/pino/icons', 'img/direct_reply.png')
104         bld.install_files('${PREFIX}/share/pino/icons', 'img/reply.png')
105         bld.install_files('${PREFIX}/share/pino/icons', 'img/re_tweet.png')
106         bld.install_files('${PREFIX}/share/pino/icons', 'img/delete_status.png')
107         bld.install_files('${PREFIX}/share/pino/icons', 'img/userpic.svg')
108         bld.install_files('${PREFIX}/share/applications', 'pino.desktop')
109         bld.install_files('${PREFIX}/share/doc/pino', 'COPYING README AUTHORS INSTALL')
110         
111         #import subprocess
112         #subprocess.Popen(['desktop-file-install', '--rebuild-mime-info-cache', bld.env.PREFIX + '/share/applications/pino.desktop'], stdout=subprocess.PIPE)
113
114 def shutdown(bld):
115         """
116         import UnitTest
117         unittest = UnitTest.unit_test()
118         unittest.want_to_see_test_output = True
119         unittest.want_to_see_test_error = True
120         unittest.run()
121         unittest.print_results()
122         """