build:wafsamba: removed most import * statements
authorThomas Nagy <tnagy@waf.io>
Tue, 27 Oct 2015 19:46:46 +0000 (20:46 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 28 Oct 2015 11:52:17 +0000 (12:52 +0100)
The 'import *' statements make it more difficult to reason about
the modules and tends to conceal bugs. These changes enable running
pyflakes against most of the build scripts.

Signed-off-by: Thomas Nagy <tnagy@waf.io>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Oct 28 12:52:17 CET 2015 on sn-devel-104

23 files changed:
buildtools/wafsamba/configure_file.py
buildtools/wafsamba/nothreads.py
buildtools/wafsamba/pkgconfig.py
buildtools/wafsamba/samba_autoconf.py
buildtools/wafsamba/samba_autoproto.py
buildtools/wafsamba/samba_bundled.py
buildtools/wafsamba/samba_conftests.py
buildtools/wafsamba/samba_cross.py
buildtools/wafsamba/samba_deps.py
buildtools/wafsamba/samba_dist.py
buildtools/wafsamba/samba_headers.py
buildtools/wafsamba/samba_install.py
buildtools/wafsamba/samba_patterns.py
buildtools/wafsamba/samba_perl.py
buildtools/wafsamba/samba_pidl.py
buildtools/wafsamba/samba_python.py
buildtools/wafsamba/samba_third_party.py
buildtools/wafsamba/samba_utils.py
buildtools/wafsamba/samba_wildcard.py
buildtools/wafsamba/symbols.py
buildtools/wafsamba/wafsamba.py
buildtools/wafsamba/wscript
pidl/wscript

index 21264cfca5cd074f6ad0af0a0ccdca32f37c13e9..e28282be3d59de0314178ac2b82a122db5c5992e 100644 (file)
@@ -1,7 +1,8 @@
 # handle substitution of variables in .in files
 
+import re, os
 import Build, sys, Logs
-from samba_utils import *
+from samba_utils import SUBST_VARS_RECURSIVE
 
 def subst_at_vars(task):
     '''substiture @VAR@ style variables in a file'''
index 075dcd326b78ea93588e1c0ac8f5dded6b634760..d194eb88a21bb79517f8caa8b714195ac88fca54 100644 (file)
 
 "Execute the tasks"
 
-import sys, random, time, threading, traceback, os
+import sys, random, threading
 try: from Queue import Queue
 except ImportError: from queue import Queue
-import Build, Utils, Logs, Options
-from Logs import debug, error
-from Constants import *
+import Utils, Options
+from Constants import EXCEPTION, CRASHED, MAXJOBS, ASK_LATER, SKIPPED, SKIP_ME, SUCCESS
 
 GAP = 15
 
index c837804ee8ece76055308dd7cc601489394f56f8..25cec781bc045a53eb18adba8657079ba7dcd994 100644 (file)
@@ -1,7 +1,8 @@
 # handle substitution of variables in pc files
 
-import Build, sys, Logs
-from samba_utils import *
+import os, re, sys
+import Build, Logs
+from samba_utils import SUBST_VARS_RECURSIVE, TO_LIST
 
 def subst_at_vars(task):
     '''substiture @VAR@ style variables in a file'''
index d7273f9932b7c109a195a86bbf718f098955875d..296f9fb843f6f27c3ecf152ea8518e00d961b00f 100644 (file)
@@ -1,10 +1,10 @@
 # a waf tool to add autoconf-like macros to the configure section
 
-import Build, os, sys, Options, preproc, Logs
-import string
+import os, sys
+import Build, Options, preproc, Logs
 from Configure import conf
-from samba_utils import *
-import samba_cross
+from TaskGen import feature
+from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, runonce, unique_list, mkdir_p
 
 missing_headers = set()
 
index bad627aa4dec33ec514fc7daa6bf774bb161c77d..b2b523366cce9703afd9d29b74dfee8328d8186a 100644 (file)
@@ -1,7 +1,8 @@
 # waf build tool for building automatic prototypes from C source
 
+import os
 import Build
-from samba_utils import *
+from samba_utils import SET_TARGET_TYPE, os_path_relpath
 
 def SAMBA_AUTOPROTO(bld, header, source):
     '''rule for samba prototype generation'''
index c8bfcd23cfd8bcf1f9925c27ee090c33ac7fc49b..a4f841bb998d68f1436b369d6f9e04223db452d9 100644 (file)
@@ -1,8 +1,9 @@
 # functions to support bundled libraries
 
+import sys
+import Build, Options, Logs
 from Configure import conf
-import sys, Logs
-from samba_utils import *
+from samba_utils import TO_LIST, runonce
 
 def PRIVATE_NAME(bld, name, private_extension, private_library):
     '''possibly rename a library to include a bundled extension'''
index 9c0b651094293361c99034bb566a0f0b736f5dee..5a9c9d59eb701f0415cf2c5d87733b4ba675c6c0 100644 (file)
@@ -1,11 +1,11 @@
 # a set of config tests that use the samba_autoconf functions
 # to test for commonly needed configuration options
 
-import os, shutil, re
-import Build, Configure, Utils
+import os, shutil, re, shlex
+import Build, Configure, Utils, Options, Logs
 from Configure import conf
 import config_c
-from samba_utils import *
+from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH
 
 
 def add_option(self, *k, **kw):
index ed3af1e7db1d371b20a374ed0f6839f6c28c77ea..b8f2000659f01663b1d288b45ea522a62f2b66db 100644 (file)
@@ -1,8 +1,8 @@
 # functions for handling cross-compilation
 
-import Utils, Logs, sys, os, Options, re
+import os, sys, re, shlex
+import Utils, Logs, Options
 from Configure import conf
-import shlex
 
 real_Popen = None
 
index 606de4120226b3e75e5e97e0585b9a97257d5f0d..f869deec9970e25ac920832f7415010ee1c932f7 100644 (file)
@@ -1,9 +1,14 @@
 # Samba automatic dependency handling and project rules
 
-import Build, os, sys, re, Environment, Logs, time
-from samba_utils import *
-from samba_autoconf import *
+import os, sys, re, time
+
+import Build, Environment, Options, Logs, Utils
+from Logs import debug
+from Configure import conf
+
 from samba_bundled import BUILTIN_LIBRARY
+from samba_utils import LOCAL_CACHE, TO_LIST, get_tgt_list, unique_list, os_path_relpath
+from samba_autoconf import library_flags
 
 @conf
 def ADD_GLOBAL_DEPENDENCY(ctx, dep):
index 654a16878e599623fbc0cb25a60ff651d0fb72ba..dbcb02a74d73e910dd26359591e59737a0614840 100644 (file)
@@ -1,8 +1,10 @@
 # customised version of 'waf dist' for Samba tools
 # uses git ls-files to get file lists
 
-import Utils, os, sys, tarfile, stat, Scripting, Logs, Options
-from samba_utils import *
+import os, sys, tarfile
+import Utils, Scripting, Logs, Options
+from Configure import conf
+from samba_utils import os_path_relpath
 
 dist_dirs = None
 dist_files = None
index 50ccad743d46d9e624d6fbfdc9832c02f374b5e2..0a800826196bcdfae993ae9be8916ca1d5bc74dd 100644 (file)
@@ -1,7 +1,8 @@
 # specialist handling of header files for Samba
 
-import Build, re, Task, TaskGen, shutil, sys, Logs
-from samba_utils import *
+import os, re, sys, fnmatch
+import Build, Logs, Utils
+from samba_utils import TO_LIST, os_path_relpath
 
 
 def header_install_path(header, header_path):
index 3d0c23a521cd50642744718d4c832cfc18724726..5f399f9ff2b5a15d19f4fdfae2f87511fe7e38bc 100644 (file)
@@ -3,9 +3,10 @@
 # with all the configure options that affect rpath and shared
 # library use
 
-import Options
+import os
+import Options, Utils
 from TaskGen import feature, before, after
-from samba_utils import *
+from samba_utils import LIB_PATH, MODE_755, install_rpath, build_rpath
 
 @feature('install_bin')
 @after('apply_core')
@@ -224,7 +225,6 @@ def symlink_bin(self):
     if self.target.endswith('.inst'):
         return
 
-    blddir = os.path.dirname(self.bld.srcnode.abspath(self.bld.env))
     if not self.link_task.outputs or not self.link_task.outputs[0]:
         raise Utils.WafError('no outputs found for %s in symlink_bin' % self.name)
     binpath = self.link_task.outputs[0].abspath(self.env)
index 5183e8657454e1f3981b939d6d48c802bac3365f..9c6d499fe34853a8ecb767f99f9a0e80e475e056 100644 (file)
@@ -1,8 +1,6 @@
 # a waf tool to add extension based build patterns for Samba
 
-import Task
-from TaskGen import extension
-from samba_utils import *
+import Build
 from wafsamba import samba_version_file
 
 def write_version_header(task):
index 3909aba2ee47e5134c1609a385d26f1aa1e49b6b..c07387a372ef3c7203ae4ce528416ae6712a5ef4 100644 (file)
@@ -1,5 +1,4 @@
-import Build
-from samba_utils import *
+import Utils
 from Configure import conf
 
 done = {}
index abf6e9c0fa3e6ad6b2678e5beb641867bf244f9b..9651e4da83606d189e2addaaed6054ee069456b6 100644 (file)
@@ -1,8 +1,9 @@
 # waf build tool for building IDL files with pidl
 
-from TaskGen import before
-import Build, os, sys, Logs
-from samba_utils import *
+import os
+import Build
+from TaskGen import feature, before
+from samba_utils import SET_TARGET_TYPE, TO_LIST, LOCAL_CACHE
 
 def SAMBA_PIDL(bld, pname, source,
                options='',
@@ -112,7 +113,6 @@ Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
 
 #################################################################
 # the rule for generating the NDR tables
-from TaskGen import feature, before
 @feature('collect')
 @before('exec_rule')
 def collect(self):
@@ -128,7 +128,6 @@ def collect(self):
 
 def SAMBA_PIDL_TABLES(bld, name, target):
     '''generate the pidl NDR tables file'''
-    headers = bld.env.PIDL_HEADERS
     bld.SET_BUILD_GROUP('main')
     t = bld(
             features = 'collect',
index a8f780f9f5d3f5f048de1f36826f2a196d912e73..6f9435002e2c39da6d8a1620269c93d6b137c924 100644 (file)
@@ -1,9 +1,7 @@
 # waf build tool for building IDL files with pidl
 
-import Build
-from samba_utils import *
-from samba_autoconf import *
-
+import os
+import Build, Logs, Utils
 from Configure import conf
 
 @conf
index 46a1b9423a6918515fa01332b1016c6cadef9573..8cfa4df7214b6d82c4acc4b4d3a021d6c136e85b 100644 (file)
@@ -1,8 +1,8 @@
 # functions to support third party libraries
 
+import os
+import Utils, Build
 from Configure import conf
-import sys, Logs, os
-from samba_bundled import *
 
 @conf
 def CHECK_FOR_THIRD_PARTY(conf):
index e6e7901d5be853afe3c64612296fe562800f0f31..f7bb11ce310824472c4c6fbe82dc9e3b7bd2366d 100644 (file)
@@ -1,11 +1,11 @@
 # a waf tool to add autoconf-like macros to the configure section
 # and for SAMBA_ macros for building libraries, binaries etc
 
-import Build, os, sys, Options, Utils, Task, re, fnmatch, Logs
+import os, sys, re, fnmatch, shlex
+import Build, Options, Utils, Task, Logs
 from TaskGen import feature, before
 from Configure import conf, ConfigurationContext
 from Logs import debug
-import shlex
 
 # TODO: make this a --option
 LIB_PATH="shared"
@@ -140,7 +140,6 @@ def exec_command(self, cmd, **kw):
     '''this overrides the 'waf -v' debug output to be in a nice
     unix like format instead of a python list.
     Thanks to ita on #waf for this'''
-    import Utils, Logs
     _cmd = cmd
     if isinstance(cmd, list):
         _cmd = ' '.join(cmd)
index 84503b8f05786818c316cde4af7ccce458b92770..3d874814df21fd87d18905092976fe58be14faef 100644 (file)
@@ -1,9 +1,9 @@
 # based on playground/evil in the waf svn tree
 
-import os, datetime
-import Scripting, Utils, Options, Logs, Environment, fnmatch
-from Constants import *
-from samba_utils import *
+import os, datetime, fnmatch
+import Scripting, Utils, Options, Logs, Environment
+from Constants import SRCDIR, BLDDIR
+from samba_utils import LOCAL_CACHE, os_path_relpath
 
 def run_task(t, k):
     '''run a single build task'''
index d37cce23a01783611b391c2e8463670aa486929b..7ff4bac7c4905547275649d9897949dd02625463 100644 (file)
@@ -1,9 +1,10 @@
 # a waf tool to extract symbols from object files or libraries
 # using nm, producing a set of exposed defined/undefined symbols
 
-import Utils, Build, subprocess, Logs, re
-from samba_wildcard import fake_build_environment
-from samba_utils import *
+import os, re, subprocess
+import Utils, Build, Options, Logs
+from Logs import debug
+from samba_utils import TO_LIST, LOCAL_CACHE, get_tgt_list, os_path_relpath
 
 # these are the data structures used in symbols.py:
 #
index ef9d43050b7c3c69ab110d4e1d77ae534fd12601..fdd0371b63c0c24163b069d874459aab7faedb7b 100644 (file)
@@ -20,6 +20,7 @@ from samba_perl import *
 from samba_deps import *
 from samba_bundled import *
 from samba_third_party import *
+import samba_cross
 import samba_install
 import samba_conftests
 import samba_abi
index 5bce17d0cb0424a550ca6a4a37e9b13d0c6ab06a..69c556c888d4c5a7a14a1925155165bd31b7e89e 100755 (executable)
@@ -2,9 +2,9 @@
 
 # this is a base set of waf rules that everything else pulls in first
 
-import sys, wafsamba, Configure, Logs
-import Options, os, preproc
-from samba_utils import *
+import os, sys
+import wafsamba, Configure, Logs, Options, Utils
+from samba_utils import os_path_relpath
 from optparse import SUPPRESS_HELP
 
 # this forces configure to be re-run if any of the configure
index 27cb230efb172fcfd82e339f00aed6d1541c813d..f4ff902812c764c2012d7edb375da31a8baedf73 100644 (file)
@@ -1,13 +1,12 @@
 #!/usr/bin/env python
 
-import os, sys, Logs
+import os, Logs
 from samba_utils import MODE_755
 
 # This function checks if a perl module is installed on the system.
 def check_system_perl_module(conf, module, version=None):
     bundle_name = module.replace('::', '_')
     module_check = module
-    found = False
 
     # Create module string with version
     if version:
@@ -65,8 +64,6 @@ def build(bld):
     # use perl to build the manpages
     bld.env.pidl_srcdir = os.path.join(bld.srcnode.abspath(), 'pidl')
 
-    blib_bld = os.path.join(bld.srcnode.abspath(bld.env), 'pidl/blib')
-
     bld.SET_BUILD_GROUP('final')
     if 'POD2MAN' in bld.env and bld.env['POD2MAN'] != '':
         for src, manpage in pidl_manpages.iteritems():