Use existing utility functions of WAF rather than our own

This commit is contained in:
Christian Dywan 2009-02-19 02:07:03 +01:00
parent 4314623138
commit 15cbd44f06
3 changed files with 19 additions and 35 deletions

View file

@ -7,11 +7,11 @@ import pproc as subprocess
for module in ('midori', 'katze'): for module in ('midori', 'katze'):
try: try:
if not os.access ('_build_', os.F_OK): if not os.access ('_build_', os.F_OK):
os.mkdir ('_build_') Utils.check_dir ('_build_')
if not os.access ('_build_/docs', os.F_OK): if not os.access ('_build_/docs', os.F_OK):
os.mkdir ('_build_/docs') Utils.check_dir ('_build_/docs')
if not os.access ('_build_/docs/api', os.F_OK): if not os.access ('_build_/docs/api', os.F_OK):
os.mkdir ('_build_/docs/api') Utils.check_dir ('_build_/docs/api')
subprocess.call (['gtkdoc-scan', '--module=' + module, subprocess.call (['gtkdoc-scan', '--module=' + module,
'--source-dir=' + module, '--output-dir=_build_/docs/api/' + module, '--source-dir=' + module, '--output-dir=_build_/docs/api/' + module,
'--rebuild-sections', '--rebuild-types']) '--rebuild-sections', '--rebuild-types'])
@ -24,7 +24,7 @@ for module in ('midori', 'katze'):
'--default-includes=%s/%s.h' % (module, module), '--default-includes=%s/%s.h' % (module, module),
'--sgml-mode', '--main-sgml-file=%s.sgml' % module]) '--sgml-mode', '--main-sgml-file=%s.sgml' % module])
if not os.access ('html', os.F_OK): if not os.access ('html', os.F_OK):
os.mkdir ('html') Utils.check_dir ('html')
os.chdir ('html') os.chdir ('html')
subprocess.call (['gtkdoc-mkhtml', module, '../%s.sgml' % module]) subprocess.call (['gtkdoc-mkhtml', module, '../%s.sgml' % module])
Params.pprint ('YELLOW', "Created documentation for %s." % module) Params.pprint ('YELLOW', "Created documentation for %s." % module)

View file

@ -2,19 +2,17 @@
# WAF build script for midori # WAF build script for midori
# This file is licensed under the terms of the expat license, see the file EXPAT. # This file is licensed under the terms of the expat license, see the file EXPAT.
import Utils
def add_image (bld, category, name): def add_image (bld, category, name):
srcdir = os.getcwd () srcdir = os.getcwd ()
blddir = bld.bdir blddir = bld.bdir
def mkdir (path):
if not os.access (path, os.F_OK):
os.mkdir (path)
rsvg_convert = bld.env['RSVG_CONVERT'] rsvg_convert = bld.env['RSVG_CONVERT']
if rsvg_convert: if rsvg_convert:
mkdir (blddir + '/icons') Utils.check_dir (blddir + '/icons')
for size in [16, 22, 32, 48]: for size in [16, 22, 32, 48]:
format = str (size) + 'x' + str (size) format = str (size) + 'x' + str (size)
@ -24,7 +22,7 @@ def add_image (bld, category, name):
elif not rsvg_convert: elif not rsvg_convert:
pass pass
elif os.access (srcdir + '/icons/scalable/' + name + '.svg', os.F_OK): elif os.access (srcdir + '/icons/scalable/' + name + '.svg', os.F_OK):
mkdir (blddir + '/icons/' + format) Utils.check_dir (blddir + '/icons/' + format)
command = rsvg_convert + ' -w ' + str(size) + \ command = rsvg_convert + ' -w ' + str(size) + \
' -h ' + str(size) + \ ' -h ' + str(size) + \
' -o ' + blddir + '/icons/' + format + '/' + name + '.png' + \ ' -o ' + blddir + '/icons/' + format + '/' + name + '.png' + \

36
wscript
View file

@ -28,10 +28,8 @@ APPNAME = 'midori'
VERSION = str (major) + '.' + str (minor) + '.' + str (micro) VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
try: try:
git = subprocess.Popen (['git', 'rev-parse', '--short', 'HEAD'], git = Utils.cmd_output (['git', 'rev-parse', '--short', 'HEAD'], silent=True)
stdout=subprocess.PIPE, stderr=subprocess.PIPE) VERSION = (VERSION + '-' + git).strip ()
if not git.wait ():
VERSION = (VERSION + '-' + git.stdout.read ()).strip ()
except: except:
pass pass
@ -233,11 +231,10 @@ def configure (conf):
# if 'soup-2.4' in conf.env['LIB_WEBKIT']: # if 'soup-2.4' in conf.env['LIB_WEBKIT']:
webkit_binary = conf.env.get_flat ('LIBPATH_WEBKIT') + '/libwebkit-1.0.so' webkit_binary = conf.env.get_flat ('LIBPATH_WEBKIT') + '/libwebkit-1.0.so'
try: try:
ldd = subprocess.Popen (['ldd', webkit_binary], ldd = Utils.cmd_output (['ldd', webkit_binary], silent=True)
stdout=subprocess.PIPE, stderr=subprocess.PIPE) if ldd != '':
if not ldd.wait ():
found = False found = False
for library in ldd.stdout.read ().split ('\n'): for library in ldd.split ('\n'):
if library[:8] == '\tlibsoup': if library[:8] == '\tlibsoup':
found = True found = True
if found: if found:
@ -292,10 +289,6 @@ def set_options (opt):
add_enable_option ('hildon', 'Maemo integration', group) add_enable_option ('hildon', 'Maemo integration', group)
def build (bld): def build (bld):
def mkdir (path):
if not os.access (path, os.F_OK):
os.mkdir (path)
bld.add_subdirs ('katze midori icons') bld.add_subdirs ('katze midori icons')
if option_enabled ('addons'): if option_enabled ('addons'):
@ -310,12 +303,9 @@ def build (bld):
if bld.env['RST2HTML']: if bld.env['RST2HTML']:
# FIXME: Build only if needed # FIXME: Build only if needed
if not os.access (blddir, os.F_OK): Utils.check_dir (blddir)
os.mkdir (blddir) Utils.check_dir (blddir + '/docs')
if not os.access (blddir + '/docs', os.F_OK): Utils.check_dir (blddir + '/docs/user')
os.mkdir (blddir + '/docs')
if not os.access (blddir + '/docs/user', os.F_OK):
os.mkdir (blddir + '/docs/user')
os.chdir (blddir + '/docs/user') os.chdir (blddir + '/docs/user')
command = bld.env['RST2HTML'] + ' -stg ' + \ command = bld.env['RST2HTML'] + ' -stg ' + \
'--stylesheet=../../../docs/user/midori.css ' + \ '--stylesheet=../../../docs/user/midori.css ' + \
@ -367,7 +357,7 @@ def build (bld):
pre.close () pre.close ()
if bld.env['RSVG_CONVERT']: if bld.env['RSVG_CONVERT']:
mkdir (blddir + '/data') Utils.check_dir (blddir + '/data')
command = bld.env['RSVG_CONVERT'] + \ command = bld.env['RSVG_CONVERT'] + \
' -o ' + blddir + '/data/logo-shade.png ' + \ ' -o ' + blddir + '/data/logo-shade.png ' + \
srcdir + '/data/logo-shade.svg' srcdir + '/data/logo-shade.svg'
@ -427,10 +417,6 @@ def shutdown ():
Utils.pprint ('RED', "Make sure intltool is installed.") Utils.pprint ('RED', "Make sure intltool is installed.")
os.chdir ('..') os.chdir ('..')
elif Options.options.run: elif Options.options.run:
def mkdir (path):
if not os.access (path, os.F_OK):
os.mkdir (path)
folder = os.path.dirname (Build.bld.env['waf_config_files'][0]) folder = os.path.dirname (Build.bld.env['waf_config_files'][0])
try: try:
ext = 'MIDORI_EXTENSION_PATH=' + folder + os.sep + 'extensions' ext = 'MIDORI_EXTENSION_PATH=' + folder + os.sep + 'extensions'
@ -442,8 +428,8 @@ def shutdown ():
lang = lang[:-3] lang = lang[:-3]
else: else:
continue continue
mkdir (folder + os.sep + 'po' + os.sep + lang) Utils.check_dir (folder + os.sep + 'po' + os.sep + lang)
mkdir (folder + os.sep + 'po' + os.sep + lang + \ Utils.check_dir (folder + os.sep + 'po' + os.sep + lang + \
os.sep + 'LC_MESSAGES') os.sep + 'LC_MESSAGES')
os.symlink (folder + os.sep + 'po' + os.sep + lang + '.mo', os.symlink (folder + os.sep + 'po' + os.sep + lang + '.mo',
folder + os.sep + 'po' + os.sep + lang + os.sep + \ folder + os.sep + 'po' + os.sep + lang + os.sep + \