import time
import urllib.request
+REQUIRED_TOOLS = {}
+
# This is a list of system utilities that are expected to be available
# to this script, and, if a non-zero version is included, the minimum
-# version required to work with this sccript.
+# version required to work with this script.
def get_list_of_required_tools():
global REQUIRED_TOOLS
REQUIRED_TOOLS = {
def __init__(self, topdir, parallelism, keep, replace_sources, strip,
full_gcc, action, exclude, shallow=False):
"""Initialize the context."""
+ self.bot_config = None
+ self.build_state = None
+ self.versions = None
self.topdir = topdir
self.parallelism = parallelism
self.keep = keep
'--prefix=%s' % installdir,
'--disable-shared']
if extra_opts:
- cfg_cmd.extend (extra_opts)
+ cfg_cmd.extend(extra_opts)
cmdlist.add_command('configure', cfg_cmd)
cmdlist.add_command('build', ['make'])
cmdlist.add_command('check', ['make', 'check'])
v = re.match(r'[0-9]+(.[0-9]+)*', v).group()
return [int(x) for x in v.split('.')]
except:
- return 'missing';
+ return 'missing'
def get_version_common_stderr(progname,line,word,arg1):
try:
v = re.match(r'[0-9]+(.[0-9]+)*', v).group()
return [int(x) for x in v.split('.')]
except:
- return 'missing';
+ return 'missing'
def get_version(progname):
- return get_version_common(progname, 0, -1, '--version');
+ return get_version_common(progname, 0, -1, '--version')
def get_version_awk(progname):
- return get_version_common(progname, 0, 2, '--version');
+ return get_version_common(progname, 0, 2, '--version')
def get_version_bzip2(progname):
- return get_version_common_stderr(progname, 0, 6, '-h');
+ return get_version_common_stderr(progname, 0, 6, '-h')
def check_version(ver, req):
for v, r in zip(ver, req):
return True
def version_str(ver):
- return '.'.join([str (x) for x in ver])
+ return '.'.join([str(x) for x in ver])
def check_for_required_tools():
get_list_of_required_tools()
if version == 'missing':
ok = 'missing'
else:
- ok = 'ok' if check_version (version, v[1]) else 'old'
+ ok = 'ok' if check_version(version, v[1]) else 'old'
if ok == 'old':
if count_old_tools == 0:
print("One or more required tools are too old:")
version_str(v[1])))
if count_old_tools > 0 or count_missing_tools > 0:
- exit (1);
+ exit(1)
def main(argv):
"""The main entry point."""
- check_for_required_tools();
+ check_for_required_tools()
parser = get_parser()
opts = parser.parse_args(argv)
topdir = os.path.abspath(opts.topdir)