summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorThomas Nagy <tnagy@waf.io>2015-10-27 20:46:46 +0100
committerAndreas Schneider <asn@cryptomilk.org>2015-10-28 12:52:17 +0100
commit2666d06f292303a57643a8ced87b8a91df2ffce1 (patch)
tree4c7eaf2bae406786baea84f1d5c92304e0eefc7d /buildtools
parent859e3415b38538ff6c023e4a56570d94a4fe4432 (diff)
downloadsamba-2666d06f292303a57643a8ced87b8a91df2ffce1.tar.gz
build:wafsamba: removed most import * statements
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
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/configure_file.py3
-rw-r--r--buildtools/wafsamba/nothreads.py7
-rw-r--r--buildtools/wafsamba/pkgconfig.py5
-rw-r--r--buildtools/wafsamba/samba_autoconf.py8
-rw-r--r--buildtools/wafsamba/samba_autoproto.py3
-rw-r--r--buildtools/wafsamba/samba_bundled.py5
-rw-r--r--buildtools/wafsamba/samba_conftests.py6
-rw-r--r--buildtools/wafsamba/samba_cross.py4
-rw-r--r--buildtools/wafsamba/samba_deps.py11
-rw-r--r--buildtools/wafsamba/samba_dist.py6
-rw-r--r--buildtools/wafsamba/samba_headers.py5
-rw-r--r--buildtools/wafsamba/samba_install.py6
-rw-r--r--buildtools/wafsamba/samba_patterns.py4
-rw-r--r--buildtools/wafsamba/samba_perl.py3
-rw-r--r--buildtools/wafsamba/samba_pidl.py9
-rw-r--r--buildtools/wafsamba/samba_python.py6
-rw-r--r--buildtools/wafsamba/samba_third_party.py4
-rw-r--r--buildtools/wafsamba/samba_utils.py5
-rw-r--r--buildtools/wafsamba/samba_wildcard.py8
-rw-r--r--buildtools/wafsamba/symbols.py7
-rw-r--r--buildtools/wafsamba/wafsamba.py1
-rwxr-xr-xbuildtools/wafsamba/wscript6
22 files changed, 64 insertions, 58 deletions
diff --git a/buildtools/wafsamba/configure_file.py b/buildtools/wafsamba/configure_file.py
index 21264cfca5c..e28282be3d5 100644
--- a/buildtools/wafsamba/configure_file.py
+++ b/buildtools/wafsamba/configure_file.py
@@ -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'''
diff --git a/buildtools/wafsamba/nothreads.py b/buildtools/wafsamba/nothreads.py
index 075dcd326b7..d194eb88a21 100644
--- a/buildtools/wafsamba/nothreads.py
+++ b/buildtools/wafsamba/nothreads.py
@@ -10,12 +10,11 @@
"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
diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
index c837804ee8e..25cec781bc0 100644
--- a/buildtools/wafsamba/pkgconfig.py
+++ b/buildtools/wafsamba/pkgconfig.py
@@ -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'''
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index d7273f9932b..296f9fb843f 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -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()
diff --git a/buildtools/wafsamba/samba_autoproto.py b/buildtools/wafsamba/samba_autoproto.py
index bad627aa4de..b2b523366cc 100644
--- a/buildtools/wafsamba/samba_autoproto.py
+++ b/buildtools/wafsamba/samba_autoproto.py
@@ -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'''
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index c8bfcd23cfd..a4f841bb998 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -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'''
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 9c0b6510942..5a9c9d59eb7 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -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):
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
index ed3af1e7db1..b8f2000659f 100644
--- a/buildtools/wafsamba/samba_cross.py
+++ b/buildtools/wafsamba/samba_cross.py
@@ -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
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index 606de412022..f869deec997 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -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):
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index 654a16878e5..dbcb02a74d7 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -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
diff --git a/buildtools/wafsamba/samba_headers.py b/buildtools/wafsamba/samba_headers.py
index 50ccad743d4..0a800826196 100644
--- a/buildtools/wafsamba/samba_headers.py
+++ b/buildtools/wafsamba/samba_headers.py
@@ -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):
diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
index 3d0c23a521c..5f399f9ff2b 100644
--- a/buildtools/wafsamba/samba_install.py
+++ b/buildtools/wafsamba/samba_install.py
@@ -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)
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index 5183e865745..9c6d499fe34 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -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):
diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py
index 3909aba2ee4..c07387a372e 100644
--- a/buildtools/wafsamba/samba_perl.py
+++ b/buildtools/wafsamba/samba_perl.py
@@ -1,5 +1,4 @@
-import Build
-from samba_utils import *
+import Utils
from Configure import conf
done = {}
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index abf6e9c0fa3..9651e4da836 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -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',
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index a8f780f9f5d..6f9435002e2 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -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
diff --git a/buildtools/wafsamba/samba_third_party.py b/buildtools/wafsamba/samba_third_party.py
index 46a1b9423a6..8cfa4df7214 100644
--- a/buildtools/wafsamba/samba_third_party.py
+++ b/buildtools/wafsamba/samba_third_party.py
@@ -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):
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index e6e7901d5be..f7bb11ce310 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -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)
diff --git a/buildtools/wafsamba/samba_wildcard.py b/buildtools/wafsamba/samba_wildcard.py
index 84503b8f057..3d874814df2 100644
--- a/buildtools/wafsamba/samba_wildcard.py
+++ b/buildtools/wafsamba/samba_wildcard.py
@@ -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'''
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index d37cce23a01..7ff4bac7c49 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -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:
#
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index ef9d43050b7..fdd0371b63c 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -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
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 5bce17d0cb0..69c556c888d 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -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