def parse_args_impl(parser, _args=None):
	global options, commands, arg_line
	(options, args) = parser.parse_args(args=_args)

	arg_line = args
	#arg_line = args[:] # copy

	# By default, 'waf' is equivalent to 'waf build'
	commands = {}
	for var in cmds: commands[var] = 0
	if not args:
		commands['build'] = 1
		args.append('build')

	# Parse the command arguments
	for arg in args:
		commands[arg] = True

	# the check thing depends on the build
	if 'check' in args:
		idx = args.index('check')
		try:
			bidx = args.index('build')
			if bidx > idx:
				raise ValueError('build before check')
		except __HOLE__, e:
			args.insert(idx, 'build')

	if args[0] != 'init':
		args.insert(0, 'init')

	# TODO -k => -j0
	if options.keep: options.jobs = 1
	if options.jobs < 1: options.jobs = 1

	if 'install' in sys.argv or 'uninstall' in sys.argv:
		# absolute path only if set
		options.destdir = options.destdir and os.path.abspath(os.path.expanduser(options.destdir))

	Logs.verbose = options.verbose
	Logs.init_log()

	if options.zones:
		Logs.zones = options.zones.split(',')
		if not Logs.verbose: Logs.verbose = 1
	elif Logs.verbose > 0:
		Logs.zones = ['runner']
	if Logs.verbose > 2:
		Logs.zones = ['*']

# TODO waf 1.6
# 1. rename the class to OptionsContext
# 2. instead of a class attribute, use a module (static 'parser')
# 3. parse_args_impl was made in times when we did not know about binding new methods to classes
dataset/ETHPy150Open appcelerator-archive/poc-nodejs-desktop/Resources/nodejs/builds/linux/node/lib/node/wafadmin/Options.py/parse_args_impl