From: Christian Dywan Date: Thu, 19 Feb 2009 01:07:03 +0000 (+0100) Subject: Use existing utility functions of WAF rather than our own X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15cbd44f06a71438cef81ea50825fbe429c28e15;p=midori Use existing utility functions of WAF rather than our own --- diff --git a/docs/api/wscript_build b/docs/api/wscript_build index 7733da71..8e72edb4 100644 --- a/docs/api/wscript_build +++ b/docs/api/wscript_build @@ -7,11 +7,11 @@ import pproc as subprocess for module in ('midori', 'katze'): try: if not os.access ('_build_', os.F_OK): - os.mkdir ('_build_') + Utils.check_dir ('_build_') 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): - os.mkdir ('_build_/docs/api') + Utils.check_dir ('_build_/docs/api') subprocess.call (['gtkdoc-scan', '--module=' + module, '--source-dir=' + module, '--output-dir=_build_/docs/api/' + module, '--rebuild-sections', '--rebuild-types']) @@ -24,7 +24,7 @@ for module in ('midori', 'katze'): '--default-includes=%s/%s.h' % (module, module), '--sgml-mode', '--main-sgml-file=%s.sgml' % module]) if not os.access ('html', os.F_OK): - os.mkdir ('html') + Utils.check_dir ('html') os.chdir ('html') subprocess.call (['gtkdoc-mkhtml', module, '../%s.sgml' % module]) Params.pprint ('YELLOW', "Created documentation for %s." % module) diff --git a/icons/wscript_build b/icons/wscript_build index 72a2326f..0687a70c 100644 --- a/icons/wscript_build +++ b/icons/wscript_build @@ -2,19 +2,17 @@ # WAF build script for midori # This file is licensed under the terms of the expat license, see the file EXPAT. +import Utils + def add_image (bld, category, name): srcdir = os.getcwd () blddir = bld.bdir - def mkdir (path): - if not os.access (path, os.F_OK): - os.mkdir (path) - rsvg_convert = bld.env['RSVG_CONVERT'] if rsvg_convert: - mkdir (blddir + '/icons') + Utils.check_dir (blddir + '/icons') for size in [16, 22, 32, 48]: format = str (size) + 'x' + str (size) @@ -24,7 +22,7 @@ def add_image (bld, category, name): elif not rsvg_convert: pass 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) + \ ' -h ' + str(size) + \ ' -o ' + blddir + '/icons/' + format + '/' + name + '.png' + \ diff --git a/wscript b/wscript index ca7f8fd9..55b8f85a 100644 --- a/wscript +++ b/wscript @@ -28,10 +28,8 @@ APPNAME = 'midori' VERSION = str (major) + '.' + str (minor) + '.' + str (micro) try: - git = subprocess.Popen (['git', 'rev-parse', '--short', 'HEAD'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if not git.wait (): - VERSION = (VERSION + '-' + git.stdout.read ()).strip () + git = Utils.cmd_output (['git', 'rev-parse', '--short', 'HEAD'], silent=True) + VERSION = (VERSION + '-' + git).strip () except: pass @@ -233,11 +231,10 @@ def configure (conf): # if 'soup-2.4' in conf.env['LIB_WEBKIT']: webkit_binary = conf.env.get_flat ('LIBPATH_WEBKIT') + '/libwebkit-1.0.so' try: - ldd = subprocess.Popen (['ldd', webkit_binary], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if not ldd.wait (): + ldd = Utils.cmd_output (['ldd', webkit_binary], silent=True) + if ldd != '': found = False - for library in ldd.stdout.read ().split ('\n'): + for library in ldd.split ('\n'): if library[:8] == '\tlibsoup': found = True if found: @@ -292,10 +289,6 @@ def set_options (opt): add_enable_option ('hildon', 'Maemo integration', group) def build (bld): - def mkdir (path): - if not os.access (path, os.F_OK): - os.mkdir (path) - bld.add_subdirs ('katze midori icons') if option_enabled ('addons'): @@ -310,12 +303,9 @@ def build (bld): if bld.env['RST2HTML']: # FIXME: Build only if needed - if not os.access (blddir, os.F_OK): - os.mkdir (blddir) - if not os.access (blddir + '/docs', os.F_OK): - os.mkdir (blddir + '/docs') - if not os.access (blddir + '/docs/user', os.F_OK): - os.mkdir (blddir + '/docs/user') + Utils.check_dir (blddir) + Utils.check_dir (blddir + '/docs') + Utils.check_dir (blddir + '/docs/user') os.chdir (blddir + '/docs/user') command = bld.env['RST2HTML'] + ' -stg ' + \ '--stylesheet=../../../docs/user/midori.css ' + \ @@ -367,7 +357,7 @@ def build (bld): pre.close () if bld.env['RSVG_CONVERT']: - mkdir (blddir + '/data') + Utils.check_dir (blddir + '/data') command = bld.env['RSVG_CONVERT'] + \ ' -o ' + blddir + '/data/logo-shade.png ' + \ srcdir + '/data/logo-shade.svg' @@ -427,10 +417,6 @@ def shutdown (): Utils.pprint ('RED', "Make sure intltool is installed.") os.chdir ('..') 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]) try: ext = 'MIDORI_EXTENSION_PATH=' + folder + os.sep + 'extensions' @@ -442,8 +428,8 @@ def shutdown (): lang = lang[:-3] else: continue - mkdir (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) + Utils.check_dir (folder + os.sep + 'po' + os.sep + lang + \ os.sep + 'LC_MESSAGES') os.symlink (folder + os.sep + 'po' + os.sep + lang + '.mo', folder + os.sep + 'po' + os.sep + lang + os.sep + \