[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools/waf
From: Thomas Nagy <tnagyemail-mail () yahoo ! fr>
Date: 2006-09-07 23:06:09
Message-ID: 1157670369.745384.4831.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 581929 by tnagy:
Configure.py update by Carlos Rafael Giani [dv dword org]
M +8 -3 demos/adv/wscript
M +38 -25 wafadmin/Configure.py
--- trunk/playground/devtools/waf/demos/adv/wscript #581928:581929
@@ -89,12 +89,17 @@
le.run()
- conf.find_header('klocale.h', ['/usr/local/include', '/usr/include', \
'/opt/kde3/include/'], define_name='KDE_DIR') + test = \
conf.create_header_enumerator() + test.names = ['klocale.h']
+ test.paths = ['/usr/local/include', '/usr/include', '/opt/kde3/include/']
+ test.run()
- conf.detect_library('XCURSOR', 'Xcursor', ['/usr/lib','/usr/X11R6/lib'])
+ #conf.find_header('klocale.h', ['/usr/local/include', '/usr/include', \
'/opt/kde3/include/'], define_name='KDE_DIR')
- conf.check_flags('Wno-pointer-sign') # typo intended
+ #conf.detect_library('XCURSOR', 'Xcursor', ['/usr/lib','/usr/X11R6/lib'])
+ conf.check_flags('-Wno-pointer-sign') # typo intended
+
# finally, write the configuration header
conf.writeConfigHeader('config.h')
--- trunk/playground/devtools/waf/wafadmin/Configure.py #581928:581929
@@ -5,6 +5,10 @@
import Params, Environment, Runner, Build, Utils
from Params import debug, error, trace, fatal
+
+import traceback
+
+
g_maxlen = 35
g_debug = 0
@@ -12,15 +16,16 @@
class enumerator_base:
def __init__(self,conf):
- self.env = None
- self.hashvalue = None
- self.conf = conf
- self.define_name = ''
+ self.env = None
+ self.conf = conf
+ self.define_name = ''
+ self.mandatory = 0
+ self.mandatory_errormsg = 'A mandatory check failed. Make sure all dependencies \
are ok and can be found.'
def update_hash(self,md5hash):
classvars = vars(self)
for (var,value) in classvars.iteritems():
- if not callable(var) and value != self and value != self.env and value != \
self.hashvalue and value != self.conf: + if not callable(var) and value != self and \
value != self.env and value != self.conf and value != self.mandatory_errormsg: \
md5hash.update(str(value))
def hash(self):
@@ -32,12 +37,21 @@
def run(self):
- if not self.compare_hash():
- return self.conf.m_cache_table[self.hashvalue]
-
+ if not Params.g_options.nocache:
+ newhash = self.hash()
+ try:
+ return self.conf.m_cache_table[newhash]
+ except KeyError:
+ pass
+
ret = self.run_impl()
-
- self.conf.m_cache_table[self.hashvalue] = ret
+
+ if self.mandatory and not ret:
+ fatal(self.mandatory_errormsg)
+
+ if not Params.g_options.nocache:
+ # Store the result no matter if it failed or not; if it is mandatory, Python \
never comes here anyway + self.conf.m_cache_table[newhash] = ret
return ret
@@ -46,21 +60,11 @@
return 0
- def compare_hash(self):
- newhash = self.hash()
- if self.hashvalue == newhash:
- return 0
- else:
- self.hashvalue = newhash
- return 1
-
-
class configurator_base(enumerator_base):
def __init__(self,conf):
enumerator_base.__init__(self,conf)
self.uselib_name = ''
- self.mandatory = 0
@@ -74,6 +78,7 @@
self.name = ''
self.paths = []
+ self.mandatory_errormsg = 'The program cannot be found. Building cannot be \
performed without this program. Make sure it is installed and can be found.'
def run_impl(self):
ret = find_program_impl(self.conf.env, self.name, self.paths)
@@ -95,7 +100,8 @@
self.header_code = ''
self.libs = []
self.lib_paths = []
-
+ self.mandatory_errormsg = 'This function could not be found in the specified \
headers and libraries. Make sure you have the right headers & libraries installed.' +
def run_impl(self):
env = self.env
if not env: env = self.conf.env
@@ -187,6 +193,7 @@
self.names = []
self.paths = []
self.code = ''
+ self.mandatory_errormsg = 'No matching library could be found. Make sure the \
library is installed and can be found.'
def update_hash(self,md5hash):
@@ -279,6 +286,7 @@
self.names = []
self.paths = []
self.code = ''
+ self.mandatory_errormsg = 'No matching header could be found. Make sure the header \
is installed and can be found.'
def run_impl(self):
env = self.env
@@ -347,6 +355,7 @@
self.cflagsparam = '--cflags'
self.cppflagsparam = '--cflags'
self.libsparam = '--libs'
+ self.mandatory_errormsg = 'The config tool cannot be found. Most likely the \
software to which the tool belongs is not installed.'
def run_impl(self):
env = self.env
@@ -388,7 +397,8 @@
self.path = ''
self.binary = ''
self.variables = []
-
+ self.mandatory_errormsg = 'No matching pkg-config package could be found. It is \
likely that the software to which the package belongs is not installed.' +
def run_impl(self):
pkgpath = self.path
pkgbin = self.binary
@@ -414,7 +424,7 @@
ret = os.popen("%s %s" % (pkgcom, self.name)).close()
self.conf.checkMessage('package %s ' % (self.name), '', not ret)
if ret: raise "error"
-
+
env['CCFLAGS_'+uselib] = os.popen('%s --cflags %s' % (pkgcom, \
self.name)).read().strip() env['CXXFLAGS_'+uselib] = os.popen('%s --cflags %s' % \
(pkgcom, self.name)).read().strip() #env['LINKFLAGS_'+uselib] = os.popen('%s --libs \
%s' % (pkgcom, self.name)).read().strip() @@ -431,8 +441,8 @@
env['LIBPATH_'+uselib] = []
for item in modpaths:
env['LIBPATH_'+uselib].append( item[2:] ) #Strip '-l'
-
- for variable in variables:
+
+ for variable in self.variables:
var_defname = ''
if len(variable) >= 2:
if variable[1]:
@@ -442,6 +452,7 @@
var_defname = uselib + '_' + variable.upper()
env[var_defname] = os.popen('%s --variable=%s %s' % (pkgcom, variable, \
self.name)).read().strip() +
except:
self.conf.addDefine(define_name, 0)
return 0
@@ -455,6 +466,7 @@
self.names = []
self.paths = []
self.code = ''
+ self.mandatory_errormsg = 'No matching library could be found. Make sure the \
library is installed and can be found.'
def run_impl(self):
env = self.env
@@ -484,6 +496,7 @@
self.names = []
self.paths = []
self.code = ''
+ self.mandatory_errormsg = 'No matching header could be found. Make sure the header \
is installed and can be found.'
def run_impl(self):
env = self.env
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic