def create_build_system(working_dir, buildsys_type=None, package=None, opts=None,<EOL>write_build_scripts=False, verbose=False,<EOL>build_args=[], child_build_args=[]):
from rez.plugin_managers import plugin_manager<EOL>if not buildsys_type:<EOL><INDENT>clss = get_valid_build_systems(working_dir, package=package)<EOL>if not clss:<EOL><INDENT>raise BuildSystemError(<EOL>"<STR_LIT>" % working_dir)<EOL><DEDENT>if len(clss) != <NUM_LIT:1>:<EOL><INDENT>s = '<STR_LIT:U+002CU+0020>'.join(x.name() for x in clss)<EOL>raise BuildSystemError(("<STR_LIT>"<EOL>"<STR_LIT>") % s)<EOL><DEDENT>buildsys_type = iter(clss).next().name()<EOL><DEDENT>cls_ = plugin_manager.get_plugin_class('<STR_LIT>', buildsys_type)<EOL>return cls_(working_dir,<EOL>opts=opts,<EOL>package=package,<EOL>write_build_scripts=write_build_scripts,<EOL>verbose=verbose,<EOL>build_args=build_args,<EOL>child_build_args=child_build_args)<EOL>
Return a new build system that can build the source in working_dir.