def main(pkg_cfg, extra): user = ask_arg("github.user", pkg_cfg, "revesansparole", extra) project = ask_arg("github.project", pkg_cfg, pkg_cfg['base']['pkgname'], extra) return dict(user=user, project=project)
def main(pkg_cfg, extra): name = ask_arg("license.name", pkg_cfg, 'mit', extra) year = ask_arg("license.year", pkg_cfg, 2015, extra) organization = ask_arg("license.organization", pkg_cfg, "oa", extra) project = ask_arg("license.project", pkg_cfg, pkg_cfg['base']['pkgname'], extra) return dict(name=name.strip(), year=year, organization=organization, project=project)
def main(pkg_cfg, extra): option = ask_arg("option_name", {}, "plugin", extra) # get handlers for this option only h = load_handlers(option) # get option examples # check tempering copy_dir("ltpkgbuilder_data/example", ".", h, pkg_cfg) return None
def test_ask_arg_user_bypass_default(): with mock.patch('ltpkgbuilder.option_tools.loc_input', return_value='myvalue'): assert ask_arg('toto', {'toto': 1}, 0, {}) == 'myvalue' assert ask_arg('toto', {}, 0, {}) == 'myvalue' assert ask_arg('toto') == 'myvalue'
def test_ask_use_default_if_everything_fail_only(): with mock.patch('ltpkgbuilder.option_tools.loc_input', return_value=''): assert ask_arg('toto', {'toto': 1}, 2) == '1' assert ask_arg('toto', {'titi': 1}, 2) == '2'
def test_ask_arg_find_default_in_pkg_cfg(): with mock.patch('ltpkgbuilder.option_tools.loc_input', return_value=''): assert ask_arg('toto', {'toto': 1}) == '1' assert ask_arg('toto', {'titi': 1}) == '' assert ask_arg('toto') == ''
def test_ask_arg_do_not_prompt_user_if_value_in_extra(): with mock.patch('ltpkgbuilder.option_tools.loc_input', return_value='useless'): assert ask_arg('toto', None, None, {'toto': 1}) == 1
def main(pkg_cfg, extra): major = ask_arg("major", pkg_cfg, "0", extra) minor = ask_arg("minor", pkg_cfg, "1", extra) post = ask_arg("post", pkg_cfg, "0", extra) return dict(major=major, minor=minor, post=post)