build:wafsamba: Removed hard-coded class names from build scripts
authorThomas Nagy <tnagy@waf.io>
Wed, 28 Oct 2015 20:04:28 +0000 (21:04 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 28 Oct 2015 20:40:24 +0000 (21:40 +0100)
Using hard-coded class names prevents subclassing and make it hard
to reason about the workflow. The wscript files read during the build
must be read during the installation phase as well.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
buildtools/wafsamba/samba_utils.py

index f7bb11ce310824472c4c6fbe82dc9e3b7bd2366d..36d3929f549f0acd9c291089ebec4d8cef97b73f 100644 (file)
@@ -2,7 +2,7 @@
 # and for SAMBA_ macros for building libraries, binaries etc
 
 import os, sys, re, fnmatch, shlex
-import Build, Options, Utils, Task, Logs
+import Build, Options, Utils, Task, Logs, Configure
 from TaskGen import feature, before
 from Configure import conf, ConfigurationContext
 from Logs import debug
@@ -656,11 +656,10 @@ def PROCESS_SEPARATE_RULE(self, rule):
         You should have file named wscript_<stage>_rule in the current directory
         where stage is either 'configure' or 'build'
     '''
-    ctxclass = self.__class__.__name__
     stage = ''
-    if ctxclass == 'ConfigurationContext':
+    if isinstance(self, Configure.ConfigurationContext):
         stage = 'configure'
-    elif ctxclass == 'BuildContext':
+    elif isinstance(self, Build.BuildContext):
         stage = 'build'
     file_path = os.path.join(self.curdir, WSCRIPT_FILE+'_'+stage+'_'+rule)
     txt = load_file(file_path)